Python 3.6 `f-strings`(PEP 498: Literal String Interpolation)
format
def __repr__(self):
return 'gate({}, {})'.format(self.tar, self.con)
f-strings
def __repr__(self):
return f'gate({self.tar}, {self.con})'
## print(Gate)
Gate = (gate(2,0), gate(2,4), gate(4,0), gate(0,2), gate(4,0), gate(3,0), gate(0,2))
print(Gate)
=>
(gate(2, 0), gate(2, 4), gate(4, 0), gate(0, 2), gate(4, 0), gate(3, 0), gate(0, 2))