diff --git a/qlasskit/qlassf.py b/qlasskit/qlassf.py index 05ddd001..47b79b3d 100644 --- a/qlasskit/qlassf.py +++ b/qlasskit/qlassf.py @@ -78,7 +78,9 @@ def __add__(self, qf2) -> "QlassF": def truth_table_header(self) -> List[str]: """Returns the list of string containing the truth table header""" header = flatten(list(map(lambda a: a.bitvec, self.args))) - header.extend([sym.name for (sym, retex) in self.expressions[-self.return_size :]]) + header.extend( + [sym.name for (sym, retex) in self.expressions[-self.return_size :]] + ) return header def truth_table(self, max=None) -> List[List[bool]]: diff --git a/qlasskit/types/__init__.py b/qlasskit/types/__init__.py index 5d41c0f3..16eb0e74 100644 --- a/qlasskit/types/__init__.py +++ b/qlasskit/types/__init__.py @@ -55,8 +55,13 @@ def const_to_qtype(value: Any): def type_repr(typ) -> str: if hasattr(typ, "__name__"): - return typ.__name__ - elif len(get_args(typ)) > 0: + if len(get_args(typ)) == 0: + return typ.__name__ + + args = [type_repr(a) for a in get_args(typ)] + return f"{typ.__name__}[{','.join(args)}]" + + elif len(get_args(typ)) > 0: # This is for python = 3.8 args = [type_repr(a) for a in get_args(typ)] if all([args[0] == a for a in args[1:]]): return f"Qlist[{args[0]}, {len(args)}]"