Re: super, decorators and gettattribute
On Jan 14, 11:47 pm, Richard Szopa <ryszard.sz...@ gmail.comwrote:
I prefer to use a class for introspection sake, since
there is no way to get information about an inner function
in a closure, whereas your users can introspect classes
pretty well.
Notice that using super(self.__cl ass__, self) is a common
mistake: the pitfalls with inheritance were discussed
very recently in this same newsgroup, you should be
able to find the post. What you need is
super(class_whe re_the_method_i s_defined, self)
which is in general different from
super(self.__cl ass__, self)
There is no clean way to determine the current class
in Python < 3.0 (Python 3.0 does it automatically);
if you want to see a hackish way involving
bytecode tricks see
(and notice that this is really not recommended).
Michele Simionato
On Jan 14, 11:47 pm, Richard Szopa <ryszard.sz...@ gmail.comwrote:
Could you tell me what are the pros and cons of the two approaches
(i.e. writing a decorator function and a decorator descriptor class)?
(i.e. writing a decorator function and a decorator descriptor class)?
there is no way to get information about an inner function
in a closure, whereas your users can introspect classes
pretty well.
super_object = super(self.__cl ass__, self)
mistake: the pitfalls with inheritance were discussed
very recently in this same newsgroup, you should be
able to find the post. What you need is
super(class_whe re_the_method_i s_defined, self)
which is in general different from
super(self.__cl ass__, self)
There is no clean way to determine the current class
in Python < 3.0 (Python 3.0 does it automatically);
if you want to see a hackish way involving
bytecode tricks see
(and notice that this is really not recommended).
Michele Simionato
Comment