[Tutor] basic Qs [tutorial / text editors / performance chara cteristics]

alan.gauld@bt.com alan.gauld@bt.com
Fri Feb 14 11:12:02 2003


> >>>a
> [1, 2, 3, 4, 5, 6]        # <-- is a and b are references of
>                             the same list object ?

Yes, all variables in Python are just names referring to objects.
Specifically they are dictionary keys...

> how to create new objects from other object ???

Make a copy. There is a copy module with deepcopy functions etc

For simple lists you can useslicing:

L1 = [1,2,3]
L2 = L1[:]   # a copy of L1's contents


> ( is object right word to use )

Yes, very pythonic to refer to things as objects.

If you need to distinguish between OOP objects and Python internal 
objects use object instance. Usually the context is enough to tell 
what you mean.

Alan g.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld/