Just looking at this -
class SuperDict(dict):
count = 0
def __init__(self, *args, **kw):
self.__class__.count = self.__class__.count+1
if kw.has_key('default'):
self.default=kw.pop('default')
super(C,self).__init__( *args, **kw)
...so, is count like a static attribute in Java (not that I really understand those anyway)?
I don't really understand how you access class attributes. Would it just be = SuperDict.count = 10?
On 4/18/05, Alan Gauld <
[EMAIL PROTECTED]> wrote:
Just back from vacation - hence the delayed response...
> > super is just a convenience feature added to make Python slightly
> > more like some other OOP languages. It is effectively just a
> > wrapper around the explicit call to the super class:
>
> No, super() is much smarter than that and was created to address
deficiencies in direct superclass
> calling. super(C, self) actually finds the class that follows C in
the method resolution order of
> the class of self. This can be very different from just calling the
base class method; in the case
> of multiple inheritance super(C, self) may not ever refer to a base
class of C.
Ah! Ok, I didn't realise that. From my quick read of the super
documentation
I missed that bit and just thought - syntactic sugar...
I see that I'll need to do some more experimenting with super...
Thanks for the clarification Kent,
Alan G.
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.'
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor