Hi Walker!

On 29 Sep., 16:42, Walker <ebwal...@gmail.com> wrote:
> ... My question is: is there a way to make Sage not
> creating a global variable but assigning directly the global one?

This is actually a Python question. It would of course be very
dangerous if variables defined outside a function would influence what
happens inside a function. So, unless you explicitly declare *inside
the function* that a variable is global, it won't be visible inside
the function.

So, you could do:
sage: def f():
....:     global x
....:     print x
....:
sage: x=3
sage: f()
3
sage: x=5
sage: f()
5

Cheers,
Simon

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to