Re: [Tutor] OO newbie

2005-04-18 Thread Alan Gauld
> 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

Re: [Tutor] OO newbie

2005-04-18 Thread Liam Clarke
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

Re: [Tutor] OO newbie

2005-04-17 Thread Alan Gauld
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

Re: [Tutor] OO newbie

2005-04-08 Thread Kent Johnson
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

Re: [Tutor] OO newbie

2005-04-08 Thread Alan Gauld
> > 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

Re: [Tutor] OO newbie

2005-04-08 Thread BRINER Cedric
> > 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

Re: [Tutor] OO newbie

2005-04-07 Thread Brian van den Broek
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"

Re: [Tutor] OO newbie

2005-04-07 Thread Brian van den Broek
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

Re: [Tutor] OO newbie

2005-04-07 Thread Jacob S.
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

Re: [Tutor] OO newbie

2005-04-07 Thread Alan Gauld
> 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

[Tutor] OO newbie

2005-04-07 Thread briner
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