On 2015-12-21 16:38, Carl Eberhart wrote:
I admit I don't understand what is happening in the following snippit:
def f():
t=var('t')
t=5
a=2*t
return a
Solution: never use var() in a function. If you do need a symbolic
variable in a function (note that you don't in the snippet above), you
can use SR.var() instead of plain var(). That behaves like var(), except
that it does not change any global. Example:
sage: SR.var('y')
y
sage: y
NameError: name 'y' is not defined
You can use it with explicit assignment:
sage: y = SR.var('y')
sage: y
y
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.