is list always with reference ?
Hans Nowak
wurmy at earthlink.net
Tue Aug 27 14:17:20 EDT 2002
quite black wrote:
> Hi,all~
>
> when we build up a list(for example named list1) and write this line:
>
> list2=list1
>
> So, list2 is reference with list1, alright ?
Sort of. list1 and list2 are names for the same object. This is true for all
Python objects, by the way, not just lists.
> What I want to know is if
> all modifications on list1 will affect list2 ? I say "All" here.
Yes, since they are the same object.
HTH,
--
Hans (base64.decodestring('d3VybXlAZWFydGhsaW5rLm5ldA=='))
# decode for email address ;-)
The Pythonic Quarter:: http://www.awaretek.com/nowak/
Kaa:: http://www.awaretek.com/nowak/kaa.html
More information about the Python-list
mailing list