New submission from Neil Girdhar <[email protected]>:
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?
----------
components: Interpreter Core
messages: 413122
nosy: NeilGirdhar
priority: normal
severity: normal
status: open
title: Please consider mentioning property without setter when an attribute
can't be set
versions: Python 3.11
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46730>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com