Thanks for the explanation but some how my code fail and since I don't
need multiple inheritance for the moment, I would settle for the not so
clean version.
The documentation of super is not very clear to me too. As seen in my
code, I am using classmethod which may cause some problem.
Steve Hold
[EMAIL PROTECTED] wrote:
> Jason Lai wrote:
>
>>If you use a newstyle class, e.g. class A(object), then you can get the
>>superclass with cls.__base__. You could also use super(cls,cls),
>>although note that it returns a object that isn't exactly the
>>same thing as a class -- but good enough fo
thanks, it works. Though I don't quite understand what super(cls,cls)
returns, and it doesn't work if I do a super(cls,cls).foo(). But
cls.__base__.foo() do the trick.
thankfully, I don't have multiple inheritance.
Jason Lai wrote:
> If you use a newstyle class, e.g. class A(object), then you ca
If you use a newstyle class, e.g. class A(object), then you can get the
superclass with cls.__base__. You could also use super(cls,cls),
although note that it returns a object that isn't exactly the
same thing as a class -- but good enough for just accessing attributes.
Make sure to check that yo
Hi,
Suppose my class definition is like this :
class A:
name = "A"
@classmethod
def foo(cls):
cls.__super.foo()
cls.bar()
@classmethod
def bar(cls):
print cls.name
class B(A):
name = "B"
class C(B):
name = "C"
What I want is
C.foo() prints