Toggle
Steven D'Aprano
steve at pearwood.info
Thu Oct 9 00:56:29 EDT 2014
More information about the Python-list mailing list
Thu Oct 9 00:56:29 EDT 2014
- Previous message (by thread): Toggle
- Next message (by thread): Toggle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 08 Oct 2014 19:34:30 -0700, Rustom Mody wrote: >>>> Color.Red > <Color.Red: 0> >>>> print (Color.Red) > Color.Red > > # Not sure what to make of that distinction... That's because the interactive interpreter displays the repr() of objects (except for None, which it suppresses), while print outputs the str() of them. py> class Test: ... def __repr__(self): return "repr" ... def __str__(self): return "str" ... py> x = Test() py> x repr py> print(x) str That's an old, old part of Python, going back to Python 1.5 or older, if I remember correctly. -- Steven
- Previous message (by thread): Toggle
- Next message (by thread): Toggle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list