Lambdas and variables

John Fouhy jfouhy at paradise.net.nz
Tue Aug 3 00:46:36 CEST 2004


James Henderson <james at logicalprogression.net> wrote in message news:<mailman.917.1091100184.5135.python-list at python.org>...
> I agree it's a gotcha.  Interestingly you would have been forced to pass 
> x in as a default argument and avoided your problem until Python 
> introduced nested scopes in versions 2.1 and 2.2.  You may find PEP 227 
> on statically nested scopes illuminating:
> 
> http://www.python.org/peps/pep-0227.html

Heh.

                                                      """ The proposed
    solution, in crude terms, implements the default argument approach
    automatically.  The "root=root" argument can be omitted. """

Ok, I've got it now (famous last words).

Thanks for your help :-)

-- 
John.



More information about the Python-list mailing list