Re: Classes: nested functions vs. private methodes

2010-05-07 Thread Steven D'Aprano
On Thu, 06 May 2010 12:40:16 +0200, Richard Lamboj wrote: > Thank you for the nice sample, but what is with multiple inheritance in > your sample? I mean the super call. Why not _MyClass.blah(self, arg). super() should work correctly when you have more complicated multiple inheritance, while cal

Re: Classes: nested functions vs. private methodes

2010-05-06 Thread Tim Roberts
Richard Lamboj wrote: > >Thank you for the nice sample, but what is with multiple inheritance in your >sample? I mean the super call. Why not _MyClass.blah(self, arg). Because then I have to remember to change the name if I should happen to change the base class, or copy this code into another c

Re: Classes: nested functions vs. private methodes

2010-05-06 Thread Richard Lamboj
Am Thursday 06 May 2010 12:02:47 schrieb Steven D'Aprano: > On Thu, 06 May 2010 11:24:49 +0200, Richard Lamboj wrote: > > Hello, > > > > what should i take: > > - nested functions: > > class MyClass(object) > > def blah(self): > > def blub(var1, var2): > > do something... > > blub

Re: Classes: nested functions vs. private methodes

2010-05-06 Thread Steven D'Aprano
On Thu, 06 May 2010 11:24:49 +0200, Richard Lamboj wrote: > Hello, > > what should i take: > - nested functions: > class MyClass(object) > def blah(self): > def blub(var1, var2): > do something... > blub(1, 5) The disadvantage of nested functions is that it is harder to test th

Classes: nested functions vs. private methodes

2010-05-06 Thread Richard Lamboj
Hello, what should i take: - nested functions: class MyClass(object) def blah(self): def blub(var1, var2): do something... blub(1, 5) or class MyClass(object) def blah(self): def _blub(var1, var2): do something... _blub(1, 5) - "private" functions: class MyCl