On Sun, 27 Feb 2005 09:07:28 +0000 (UTC), Alan Gauld
<[EMAIL PROTECTED]> wrote:

> >>> adds = [lambda y: (y + n) for n in range(10)]
> >>> adds[0](0)
> 9
> >>> for n in range(5): print adds[n](42)
> ...
> 42
> 43

> the for loop... It seems to somehow be related to the 
> last value in the range(), am I somehow picking that up as y?

Further exploration suggests I'm picking it up as n not y, if
that indeed is what's happening...

Alan G.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to