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

Xiang Zhang report at bugs.python.org
Mon Aug 22 13:40:40 EDT 2016


Xiang Zhang added the comment:

One solution I can think of is alter the constructor of property() and add an optional name attribute to it. If users really care about the exception message, they can set the attribute to the property's name. If they don't care, everything remains the same as now. This is just like the doc parameter of property() right now and the first parameter of type() when it is used to create a class dynamically. This is just a suggestion, I am not sure it's worth to do it.

----------

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


More information about the Python-bugs-list mailing list