Andrei Kulakov <andrei....@gmail.com> added the comment:

Joe: when I ran your code sample with modification I posted previously, I don't 
get any errors. Can you try running it?

By the way my point was not that builtin __repr__ should be modified to never 
raise exceptions (which would not help in this case), but rather that users 
should try to write classes that can be safely repr()'ed with the __repr__ they 
have defined on the class.

I agree that this case is hard for new users to debug, but it indicates to the 
user that if a class and its __repr__ are implemented in this way, it can lead 
to more serious issue in production.

Possibly this can be improved by making a documentation update to 
https://docs.python.org/3/reference/datamodel.html?highlight=__repr__#object.__repr__
  ?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43656>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to