method in the definiton of a methond

Terry Reedy tjreedy at udel.edu
Wed Oct 29 12:09:14 EST 2003


"Zunbeltz Izaola" <zunbeltz at wm.lc.ehu.es.XXX> wrote in message
news:m13cdcgufw.fsf at lcpxdf.wm.lc.ehu.es...
> I what to change de definiton of Move to something like
>     def Move(self, table, angle,handle=self.GetNewHandle):

The def header, including default arg expression, is 'executed' to
construct the function and is not part of the body executed when the
constructed function is executed.  When the function is created,
'self' is just a name not yet bould to anything.  What you want is
...handle = None): followed by
a first line of 'if handle == None: handle = self.GetNewHandle'.

Terry J. Reedy









More information about the Python-list mailing list