Re: Scope of decorator argument

2006-10-17 Thread Gregor Horvath
Gregor Horvath schrieb: > > Is there any other solution, probably with metaclasses ? > I've found this one: class mymeta(type): def __new__(meta, class_name, bases, new_attrs): new_attrs["edit"] = adecorator(new_attrs['xy'])(bases[0].edit)) return type.__new__(meta, class_na

Scope of decorator argument

2006-10-16 Thread Gregor Horvath
Hi, this: class base(object): @adecorator(xy) def edit(self): print "edit" class child(base): xy = 3 obviously fails because "xy" is not bound at class creation time of the base object. One solution could be delegation: class base(object): @classmethod def edit(se