Message277158
@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 |
|
Date |
User |
Action |
Args |
2016-09-21 15:22:05 | ncoghlan | set | recipients:
+ ncoghlan, python-dev, eric.snow, serhiy.storchaka, Martin.Teichmann, Tim.Graham, Martin Teichmann |
2016-09-21 15:22:05 | ncoghlan | set | messageid: <1474471325.78.0.688729574535.issue28214@psf.upfronthosting.co.za> |
2016-09-21 15:22:05 | ncoghlan | link | issue28214 messages |
2016-09-21 15:22:05 | ncoghlan | create | |
|