Advertisement
doanhtu

__repr__ purpose

Aug 29th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. In [1]: class Foo:
  2.    ...:     pass
  3.  
  4. In [2]: print(Foo())
  5. <__main__.Foo object at 0x7fad57712400>
  6.  
  7. In [3]: class Bar:
  8.    ...:     def __repr__(self):
  9.    ...:         return "Ahihi"
  10.  
  11. In [4]: print(Bar())
  12. Ahihi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement