How can this be?

leeg leeg at teaching.physics.ox.ac.uk.valid
Thu Feb 5 21:56:42 EST 2004


Paul Prescod wrote:

> If you wish the function to work with a copy, try this:
> 
>       from A import *
>       L = [0]
>       print L
>       x = f(L[:], 'a data string')
>       print L

Heh, and there was me doing:
def copylist(source):
  dest=[]
  for i in source:
    dest.append(i)
  return dest

a few tens of thousands of times a minute.  I guess using slices is faster
:-)

Cheers,
leeg.
-- 
I am leeg, for we are many.
http://users.ox.ac.uk/~wadh1342



More information about the Python-list mailing list