who to call a list of method inside the class itself
maduma at pt.lu
maduma at pt.lu
Tue Aug 19 10:45:12 EDT 2008
On Aug 19, 4:33 pm, Fredrik Lundh <fred... at pythonware.com> wrote:
> mad... at pt.lu wrote:
> > Is the following code is ok. who to call all method.
> > It is working but the call to m() without a reference to self seems
> > strange
>
> > Thanks for your help
>
> > class CustomMethod:
> > def method1(self):
> > ....
> > def method2(self):
> > ....
> > def method3(self):
> > ....
>
> > def getAllMethod(self):
> > return [self.method1, self.method2, self.method3]
>
> > def applyAll(self):
> > for m in self.getAllMethod():
> > # how to call all methods ?
> > # is it correct
> > m()
>
> what happens when you run the code?
>
> </F>
The code it is running fine but i just wondering if it's the syntax is
correct (avoid any side effect)
-Stephane
More information about the Python-list
mailing list