Python is DOOMED! Again!

Ethan Furman ethan at stoneleaf.us
Sat Jan 31 23:31:17 EST 2015


On 01/31/2015 07:16 PM, Steven D'Aprano wrote:
> 
> But by default, Python will fallback on __repr__ if __str__ doesn't exist,
> or __str__ if __repr__ doesn't exist, or both. Or something. (I always
> forget what the rules are exactly.)

If __str__ is missing, __repr__ is called.

If __repr__ is missing, object.__repr__ (or some intermediate base class' __repr__) is called.

--
~Ethan~

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20150131/c652e63c/attachment.sig>


More information about the Python-list mailing list