> class SuperDict(dict):
>count = 0
>def __init__(self, *args, **kw):
> self.__class__.count = self.__class__.count+1
> ...
> super(C,self).__init__( *args, **kw)
>...so, is count like a static attribute in Java
Yes, it is a class variable - something that tells you abo
Hi,
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 stat
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
Alan Gauld wrote:
this exemple will also works if you replace the:
super(C,self).__init__( *args, **kw)
by
dict.__init__(self, *args, **kw)
but I do not understand this dict.__init_... call.
Shouldn't you call the super class constructor??
super is just a convenience feature added to make Python s
> > 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:
> >
> > Thus super(C,self...) is the same as
> >
> > dict.__init__(self...)
> after you telling me that dic
> > 1-
> > this exemple will also works if you replace the:
> > super(C,self).__init__( *args, **kw)
> > by
> > dict.__init__(self, *args, **kw)
> >
> > but I do not understand this dict.__init_... call.
> > Shouldn't you call the super class constructor??
>
> super is just a convenience feature a
Brian van den Broek said unto the world upon 2005-04-08 00:00:
>>> class Shy:
'''My silly example'''
def _shy_method(self):
'''I am a shy docstring'''
print "I'm a shy method"
def public_method(self):
'''I am a public docstring'''
print "I'm a public method"
Jacob S. said unto the world upon 2005-04-07 21:18:
2-
what are the differences between
self.__DoubleUnderscore
self._SimpleUnderscore
Double Underscores are way cooler!
Here's why.
Single underscores are just subtle clues to the user of the class that
you aren't specifically supposed to call tha
2-
what are the differences between
self.__DoubleUnderscore
self._SimpleUnderscore
Double Underscores are way cooler!
Here's why.
Single underscores are just subtle clues to the user of the class that you
aren't specifically supposed to call that function of the class. IOW, its
used internally bu
> 1-
> this exemple will also works if you replace the:
> super(C,self).__init__( *args, **kw)
> by
> dict.__init__(self, *args, **kw)
>
> but I do not understand this dict.__init_... call.
> Shouldn't you call the super class constructor??
super is just a convenience feature added to make Python
hi,
Hi, I'm having some trouble to understand how to program in OO and to
know what are the possibilities offered by OO programming in python.
This is even more difficult when you -unfortunately- don't know any
other OO languages.
for example I try to improve a dict class whom you can set up a de
11 matches
Mail list logo