Message21204
Logged In: YES
user_id=676422
I like the example, but the new explanation still leaves the
impression that super() returns a class ( or something that
acts like a class). This is what made super() so difficult to
figure out the first time I tried it. The 'super' object returned
by the function appears to be a collection of references, one
to the 'self' instance, and one to each of the classes in the
MRO of self above 'cls'. The reason it can't be just a class is
that a given super object needs to retrieve a different class
each time it is used, depending on what method is provided.
The only thing lacking in the example is motivation for why we
need super(B,self).meth(arg) instead of just calling C.meth
(self,arg). I have a longer example and some motivation on
page 16 in my OOP chapter at
http://ece.arizona.edu/~edatools/Python/PythonOOP.doc but
that may be too long if what we need here is a "man page"
explanation.
|
|
Date |
User |
Action |
Args |
2007-08-23 14:22:39 | admin | link | issue973579 messages |
2007-08-23 14:22:39 | admin | create | |
|