Thanks for the quick reply Diez! But your code gives
the same results as my original, despite the removal
of the conflict with the built-in 'list'
Having thought about it some more though it is
becoming somewhat clearer, and I will try to explain
> from copy import copy, deepcopy
> class Test:
> def __init__(self):
> def __copy__(self):
> return Test()
> print ll is copy(ll) # False
copy(ll) is a new object, so this is false
> print identitylist is copy(ll) # False
> identitylist=copy(ll) # still doesn't work
> print identitylist is ll # True
by assigning to identitylist, we have also assigned
to ll, so this test is true
> print newlist is ll # False
now we have asssigned to a completely new list.
I think I am right in saying copying in python is a
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now