ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 31 Dec 2019 11:41:55 -0600Local/global variable behaviour of listshttp://ask.sagemath.org/question/49283/localglobal-variable-behaviour-of-lists/(This might be, in some way, related to this [bug](https://ask.sagemath.org/question/48786/bug-gap3-interface-confuses-variables/)).
I recently discovered the following behaviour, which I found quite surprising - if this is intentional, can someone please explain to me why this is supposed to happen?
def bla(x):
x = 2
def bla2(K):
K[0] = 2
def bla3(K):
T = K
T[0] = 2
Defining
x = 1
L = [1]
and then running bla(x) does not change the value of x, but running bla2(L) or bla3(L) DOES change the value of L to [2].Bob67846Tue, 31 Dec 2019 11:41:55 -0600http://ask.sagemath.org/question/49283/Use the global variables assigned in an iterative expressionhttp://ask.sagemath.org/question/25920/use-the-global-variables-assigned-in-an-iterative-expression/ Hi everyone.
Assume that I have assigned some global variables to items of a list L (L is a list of polynomials guess) such as
for i, item in enumerate(L):
globals()['g%s'%i] = item
Now I want to get the multiplication of
g0*g1*g2*...
and so on.
But I can not do
mul('g%s'%i..)
or something.
How can I get this multiplication (as an example of the concept) without writing all the assigned g0, g1, etc.?
Thanks for help,algebraicallyclosedTue, 24 Feb 2015 09:39:20 -0600http://ask.sagemath.org/question/25920/