New submission from Frank Millman:

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

----------
components: Library (Lib)
messages: 212340
nosy: frankmillman
priority: normal
severity: normal
status: open
title: copy.copy(bytes) is slow
type: performance
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20791>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to