This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author frankmillman
Recipients frankmillman
Date 2014-02-27.08:58:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393491483.28.0.0745198504357.issue20791@psf.upfronthosting.co.za>
In-reply-to
Content
Using copy.copy on a byte string returns a new copy instead of the original immutable object. Using copy.deepcopy returns the original, as expected. Testing with timeit, copy.copy is much slower than copy.deepcopy.

>>> import copy
>>>
>>> a = 'a'*1000  # string
>>> copy.copy(a) is a
True
>>> copy.deepcopy(a) is a
True
>>>
>>> b = b'b'*1000  # bytes
>>> copy.copy(b) is b
False
>>> copy.deepcopy(b) is b
True
History
Date User Action Args
2014-02-27 08:58:03frankmillmansetrecipients: + frankmillman
2014-02-27 08:58:03frankmillmansetmessageid: <1393491483.28.0.0745198504357.issue20791@psf.upfronthosting.co.za>
2014-02-27 08:58:03frankmillmanlinkissue20791 messages
2014-02-27 08:58:02frankmillmancreate