Michał Bentkowski pisze:
> Why does python create a reference here, not just copy the variable?

Because Python works like that -- it uses names and values idiom. If you
change value, all names will be bound to the same changed value.

>>>> j=range(0,6)
>>>> k=j
>>>> del j[0]
>>>> j
> [1, 2, 3, 4, 5]
>>>> k
> [1, 2, 3, 4, 5]
> 
> Shouldn't k remain the same?

No further comments on this.

-- 
Jarek Zgoda
http://zgodowie.org/

"We read Knuth so you don't have to" - Tim Peters
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to