python copy method alters type
Zhenhai Zhang
zhenhai.zhang at gmail.com
Thu May 14 09:05:38 EDT 2009
More information about the Python-list mailing list
Thu May 14 09:05:38 EDT 2009
- Previous message (by thread): introspection question: get return type
- Next message (by thread): python copy method alters type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Really weired; Here is my code:
a = ["a", 1, 3, 4]
print "a:", a
c = copy(a)
c[0] = "c"
c[1] = 2
print "c:", c
print "a:",a
output as follows:
a: ['a', 1, 3, 4]
c: ['c' '2' '3' '4']
a: ['a', 1, 3, 4]
Btw, I'm using python 2.5. I'm very curious why the copied list changed
data type.
Thanks,
Zhenhai
- Previous message (by thread): introspection question: get return type
- Next message (by thread): python copy method alters type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list