Re: Private functions and inheritance

2007-07-16 Thread Bruno Desthuilliers
Maciej Bliziński a écrit : (snip the rest - already answered by at least 3 persons). > I > don't want to expose the __bar() function outside, but on the other > hand i want to defer its implementation to a subclass. It seems like I > need to make it public, doesn't it? First, keep in mind that th

Re: Private functions and inheritance

2007-07-16 Thread Neil Cerutti
On 2007-07-16, Maciej Blizi?ski <[EMAIL PROTECTED]> wrote: > Hello, > > I've come across something that I don't quite understand about > Python's inheritance. Consider the following code snippet: > > class A(object): > def call_bar(self): return self.bar() > def call___bar(self): return sel

Re: Private functions and inheritance

2007-07-16 Thread Diez B. Roggisch
Maciej Bliziński wrote: > Hello, > > I've come across something that I don't quite understand about > Python's inheritance. Consider the following code snippet: > > class A(object): > def call_bar(self): return self.bar() > def call___bar(self): return self.__bar() > def __bar(self):

Re: Private functions and inheritance

2007-07-16 Thread Bjoern Schliessmann
Maciej Blizi?ski wrote: > calling B::call_bar(): B::bar() > calling B::call___bar(): A::__bar() (BTW, there is no :: operator in Python. It should be, e. g., B.bar().) > In the latter case, it calls the base class' implementation. It > probably goes along with Python's spec, but I found it surp

Private functions and inheritance

2007-07-16 Thread Maciej Bliziński
Hello, I've come across something that I don't quite understand about Python's inheritance. Consider the following code snippet: class A(object): def call_bar(self): return self.bar() def call___bar(self): return self.__bar() def __bar(self): return "A::__bar()" def bar(self): ret