[issue29848] Cannot use Decorators of the same class that requires an instance of itself to change variables in that class.

2017-03-18 Thread R. David Murray
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

[issue29848] Cannot use Decorators of the same class that requires an instance of itself to change variables in that class.

2017-03-18 Thread Decorater
Decorater added the comment: hmm, I see. Well I was looking for an way to actually be able to use decorators made in the same class to be able to somehow pass in the same instance as well. Currently the only way to use class decorators is for them to be static (which would not allow using or

[issue29848] Cannot use Decorators of the same class that requires an instance of itself to change variables in that class.

2017-03-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Its not clear what you are asking for here. Do you think the current behaviour is a bug? Are you asking for a new feature? What do you want? When the decorator is called, "self" doesn't exist, so of course @self.decorator *must* fail. What else could it do?

[issue29848] Cannot use Decorators of the same class that requires an instance of itself to change variables in that class.

2017-03-18 Thread Decorater
New submission from Decorater: So, many people rely on Decorators in class that accepts an instance of itself like so: class ExampleClass: """Example class with an example decorator that cannot be used.""" def __init__(self): self.list_of_items = [] def add_item(self,