Nick Coghlan added the comment: @property can be used to define a broken __set_name__ attribute:
>>> class BadIdea: ... @property ... def __set_name__(self): ... pass ... >>> class NotGoingToWork: ... attr = BadIdea() ... Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'NoneType' object is not callable And there's also a failing __set_name__ call: >>> class FaultyImplementation: ... def __set_name__(self, *args): ... 1/0 ... >>> class TheoreticallyCouldWork: ... attr = FaultyImplementation() ... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 3, in __set_name__ ZeroDivisionError: division by zero ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28214> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com