I'm trying to generate a list of functions where each function returns
its place in a list. Here is my code:
cc=[(lambda: x) for x in [1..2]]
However, I have:
cc[0]() returns 2 (but I want it to return 1)
cc[1]() returns 2 (correctly)
Does anyone know what is going on here? It seems like all the functions
just end up being the last function!
Thanks,
Jason
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org