[issue27794] setattr a read-only property; the AttributeError should show the attribute that failed

Raymond Hettinger report at bugs.python.org
Sun Dec 27 16:41:34 EST 2020


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

Yurii, this looks nice.  I question whether *name* should be a part of the constructor because it immediately gets overridden by __set_name__ method.

>>> class A:
...    def x(self):
...        return 44
...    x = property(x, name='y')
...
>>> vars(A)['x'].name
'x'

----------
assignee:  -> rhettinger
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue27794>
_______________________________________


More information about the Python-bugs-list mailing list