Lambdas and variables

John Fouhy jfouhy at
Tue Aug 3 00:46:36 CEST 2004

James Henderson <james at> wrote in message news:<mailman.917.1091100184.5135.python-list at>...
> 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:


                                                      """ 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 :-)


More information about the Python-list mailing list