andrea crotti <[EMAIL PROTECTED]> writes:
> Hi everbybody again,
> I have a little "problem", I don't understand the reason of this:
>
> a = [10,1,2,3]
> def foo():
> global a
> for n in range(len(a)):
> a[n] = a[n]*2
If I type the above, and then call foo, I get what looks like
reasonabl
On 2005-05-08, andrea crotti wrote:
> I have a little "problem", I don't understand the reason of this:
> a = [10,1,2,3]
> def foo():
> global a
> for el in a:
> el = el*2
Simple data types (as integer) are _not_ implemented as references as
you obviously expected. Instead el is copied b
Hi everbybody again,
I have a little "problem", I don't understand the reason of this:
a = [10,1,2,3]
def foo():
global a
for el in a:
el = el*2
This doesn't make any difference, if I do
def foo():
global a
a[0] = 4
But
def foo():
global a
for n in range(len(a)):
a[n] = a[n]