[sage-support] Re: list of functions

2009-01-29 Thread martin Campos Pinto
> This is caused by the scoping rules for Python's lambdas and list > comprehensions. See the question and answer here for an > explanation:http://stackoverflow.com/questions/139819/why-results-of-map-and-list... > > --Mike ...ok, so, a way to write it would be b = [lambda x,u=i:u for i in ran

[sage-support] Strange behaviour of float()?

2009-01-29 Thread martin Campos Pinto
Hi everybody, in my Notebook (version 3.2.3) I get the following: sage: a = float(1>1) sage: a 0.0 sage: var('x') sage: b(x) = float(x>1) Traceback (most recent call last): File "", line 1, in File "/Users/campos/.sage/sage_notebook/worksheets/admin/4/code/ 204.py", line 8, in _=var

[sage-support] list of functions

2009-01-29 Thread martin Campos Pinto
Hi again, ... and again sorry if this is a newbie's question: so when I type (in my sage Notebook 3.2.3) a = [i for i in range(2)] a[0] I get 0 (which is fine), now when I type b = [lambda x:i for i in range(2)] b[0](0) I get 1 ... There must be a simple explanation for this but I can't figur