[New-bugs-announce] [issue20791] copy.copy(bytes) is slow

Frank Millman report at bugs.python.org
Thu Feb 27 09:58:03 CET 2014

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
>>> copy.deepcopy(a) is a
>>> b = b'b'*1000  # bytes
>>> copy.copy(b) is b
>>> copy.deepcopy(b) is b

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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list