Message181567
You are correct. Effectively every class has an __str__, and that is what gets called when you print something without specifying any other formatting. (I say effectively, because if there is no __str__ the __repr__ gets used, which every class *does* have via inheritance from the base object 'object'.)
For what it is worth, I just gave David Beasly's "Python Essential Reference" to someone who is a relatively new Python programmer but an experienced programmer, and he loved it. |
|
Date |
User |
Action |
Args |
2013-02-06 19:56:26 | r.david.murray | set | recipients:
+ r.david.murray, mark.dickinson, vstinner, Dave |
2013-02-06 19:56:26 | r.david.murray | set | messageid: <1360180586.63.0.406140306203.issue17139@psf.upfronthosting.co.za> |
2013-02-06 19:56:26 | r.david.murray | link | issue17139 messages |
2013-02-06 19:56:26 | r.david.murray | create | |
|