Confusion over calling a nested function inside a parent function

Pyenos pyenos at pyenos.org
Fri Dec 22 08:40:37 EST 2006


"MacDonald" <crazymykl at gmail.com> writes:

> Pyenos wrote:
> > [code]
> > class WORK:
> >     def getwork(self):
> >         def choosetable(self):pass
> >         choosetable() #TypeError: choosetable() takes exactly 1
> >                       #argument (0 given)
> > [/code]
> >
> > Calling choosetable() at the above location gives me the error
> > described above.
> 
> Although choosetable is a memeber of an instance method, it is not one
> itself.  It should not have self as it's first formal parameter.

[code]
class WORK:
        def getwork(self):
                def choosetable():pass
                choosetable()
[/code]

like this? thank you! ;-)



More information about the Python-list mailing list