using super
Scott David Daniels
Scott.Daniels at Acm.Org
Mon Dec 31 19:19:11 EST 2007
More information about the Python-list mailing list
Mon Dec 31 19:19:11 EST 2007
- Previous message (by thread): using super
- Next message (by thread): using super
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Steven D'Aprano wrote: > On Mon, 31 Dec 2007 08:03:22 -0800, Scott David Daniels wrote: >> Steven D'Aprano wrote: ... >>> def chain(meth): # A decorator for calling super. >>> def f(self, *args, **kwargs): >>> result = meth(self, *args, **kwargs) >>> S = super(self.__class__, self) >> This line is the problem. The class parameter needs to be the class >> (B in this case) in which the chaining method is defined, not that >> of the object itself. > One minor correction: the class parameter needs to be the class *itself*, > not the class *name* (which would be the string "B"). Point taken. > I don't quite understand your description though. What do you mean "the > chaining method is defined"? chain() is defined outside of a class. The class where f (the chaining method) is defined; equivalently, the class in which the @chain is used. -Scott
- Previous message (by thread): using super
- Next message (by thread): using super
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list