Confusion over calling a nested function inside a parent function

MacDonald crazymykl at gmail.com
Fri Dec 22 08:35:24 EST 2006


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.




More information about the Python-list mailing list