hii

madhuri vio madhuri.vio at gmail.com
Tue Jun 1 03:16:15 EDT 2010


i wanted to know the difference between copy composed objects and
independent objects


composed objects

>>> firstserie = all_2_digests([’EcoRI’, ’HindIII’, ’BamHI’])

>>> firstserie

[[’EcoRI’, ’HindIII’], [’EcoRI’, ’BamHI’], [’HindIII’, ’BamHI’]]

>>> newserie = firstserie[1:]

>>> newserie

[[’EcoRI’, ’BamHI’], [’HindIII’, ’BamHI’]]

>>> newserie[1][0]=’SarI’

>>> newserie

[[’EcoRI’, ’BamHI’], [’SarI’, ’BamHI’]]

>>> firstserie

[[’EcoRI’, ’HindIII’], [’EcoRI’, ’BamHI’], [’SarI’, ’BamHI’]]


independent objects

  >>> firstserie = all_2_digests([’EcoRI’, ’HindIII’, ’BamHI’])

>>> firstserie

[[’EcoRI’, ’HindIII’], [’EcoRI’, ’BamHI’], [’HindIII’, ’BamHI’]]

>>> import copy

>>> newserie = copy.deepcopy(firstserie)[1:]

>>> newserie

[[’EcoRI’, ’BamHI’], [’HindIII’, ’BamHI’]]

>>> newserie[1][0]=’SarI’

>>> newserie

[[’EcoRI’, ’BamHI’], [’SarI’, ’BamHI’]]

>>> firstserie

[[’EcoRI’, ’HindIII’], [’EcoRI’, ’BamHI’], [’HindIII’, ’BamHI’]]


i want to know the difference in the context of this program

-- 
madhuri :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100601/19062184/attachment.html>


More information about the Python-list mailing list