Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foobar:
- def __str__(self):
- return f'{self.__class__.__name__}: ({", ".join((str(v) for v in self.__dict__.values()))})'
- def __repr__(self):
- return f'<{self.__class__.__name__}: {self.__dict__}>'
- def __init__(self):
- self.foo = 'foo_value'
- self.bar = 'bar_value'
- self.baz = 'baz_value'
- f = Foobar()
- print(f)
- print(str(f)) # == print(f)
- print(repr(f))
Add Comment
Please, Sign In to add comment