member by member copy???

bragib at my-deja.com bragib at my-deja.com
Wed May 10 10:44:29 EDT 2000


How do I copy on object into another without having them
refer to each other.
Example:

>>> class A:
...    def __init__(self,name):
...        self.name = name
...
>>> a = A('bragi')
>>> b = a
>>> b.name
'bragi'
>>> b.name= 'stina'
>>> a.name
'stina'

I would have liked to see
>>> a.name
'bragi'

How do I do this?


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list