Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

> In my opinion, it's expected behavior that `name` is 
> overwritten by `__set_name__` method.

It is almost certain that there will be others won't share that expectation.  
The StackOverflow questions and bug reports are inevitable.

Most examples of __set_name__() use a private attribute.  I recommend that you 
go that route and stick to the spirit of the original bug report.  The OP asked 
for better error messages when possible.  They didn't ask for an API expansion.

> I have added `name` to `property` constructor to support cases
> when a property is added to a class after it was declared.

That rarely occurs in practice.  I wouldn't worry about it.  Also AFAICT the 
only time the new error message matters is in the context of a setattr() where 
the attribute isn't already shown in the traceback.  So the case in question is 
really a rarity inside another rarity.  Let's declare YAGNI unless an actual 
end-user problem arises in real-world code.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27794>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to