Is this an Intended behaviour of __getattr__?

Terry Reedy tjreedy at home.com
Fri Jul 27 11:11:38 EDT 2001


"Grace" <nospam at nospam.com> wrote in message
news:OR887.104175$ph7.16309267 at news.hananet.net...

> I think when __repr__ and __str__ are called internally via the
interpreter
> as in the print statement, it passes through the __getattr__ method
of Node
> class while all exceptions are simply ignored.

Correct.  Overriding default print formatting is optional.  When
'print' found neither __str__ nor __repr__ , it went ahead with the
default:

<__main__.Node instance at 0081608C>

Terry J. Reedy







More information about the Python-list mailing list