R. David Murray added the comment:

Decorators are called with the decorated *function* objection when the class is 
compiled.  There can be no instance involved by their very nature, since the 
instance doesn't exist yet.  So no, you can't have a decorator that affects 
instance attributes at the compile step.  You *can* have a decorator that 
*effectively* manipulates instance attributes by returning a wrapper function, 
which will receive self when called, and can do whatever it wants.

There is no bug here, nor any need for a feature.  You can already do what you 
want, you just have to write your decorator correctly.  You can even have it as 
a static method of the class, though I'm not sure I'd consider that good style 
(but people's opinions on style differ).

----------
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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

Reply via email to