Message212340
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 |
|
Date |
User |
Action |
Args |
2014-02-27 08:58:03 | frankmillman | set | recipients:
+ frankmillman |
2014-02-27 08:58:03 | frankmillman | set | messageid: <1393491483.28.0.0745198504357.issue20791@psf.upfronthosting.co.za> |
2014-02-27 08:58:03 | frankmillman | link | issue20791 messages |
2014-02-27 08:58:02 | frankmillman | create | |
|