mis6 at pitt.edu
Thu Jan 23 21:30:12 CET 2003
Aum <spam-me at no-thanks.com> wrote in message news:<YMRX9.43233$F63.924790 at news.xtra.co.nz>...
> But there's a real problem with staticmethod. Within a staticmethod
> function, I can't see any way to access other static attributes of the
> class - methods or attributes - without knowing the class' name.
> With this restriction, python's static method implementation falls short of
> that of C++ (I won't say j--- because I don't know j---). At least in C++,
> you can subclass a class with static methods, and within the subclass, the
> inherited methods can access other static attributes within the class,
> without having to explicitly specify the class.
You can call a staticmethod of the parent from a staticmethod of the
children without naming the parent explicitely:
f=staticmethod(lambda : 'I am B.f')
C.g() # => I am B.f
I was unable to do that with 'super', however. If somebody has a better
recipe I would be interested in knowing it.
More information about the Python-list