Message413122
class C:
@property
def f(self) -> int:
return 2
class D(C):
pass
D().f = 2
Gives:
Traceback (most recent call last):
File "/home/neil/src/cmm/a.py", line 10, in <module>
D().f = 2
AttributeError: can't set attribute 'f'
This can be a pain to debug when the property is buried in a base class. Would it make sense to mention the reason why the attribute can't be set, namely that it's on a property without a setter? |
|
Date |
User |
Action |
Args |
2022-02-12 11:15:48 | NeilGirdhar | set | recipients:
+ NeilGirdhar |
2022-02-12 11:15:48 | NeilGirdhar | set | messageid: <1644664548.7.0.814482728123.issue46730@roundup.psfhosted.org> |
2022-02-12 11:15:48 | NeilGirdhar | link | issue46730 messages |
2022-02-12 11:15:48 | NeilGirdhar | create | |
|