paul rubin [EMAIL PROTECTED] added the comment:
If it's not a bug, it is at least a surprising gotcha that should be
documented in the manual. The collections module is described in the
library docs as high performance container datatypes but I could not
possibly consider the observed behavior
Antoine Pitrou [EMAIL PROTECTED] added the comment:
Well, perhaps the deque documentation should make it clear that random
access is O(n), rather than O(1) for a list. With this information it is
easy to infer that operations such as shuffle() can be much slower on a
deque.
--
assignee:
Changes by Raymond Hettinger [EMAIL PROTECTED]:
--
assignee: georg.brandl - rhettinger
nosy: +rhettinger
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4123
___
Raymond Hettinger [EMAIL PROTECTED] added the comment:
Will add a note to the deque docs that random access is O(n).
--
priority: normal - low
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4123
Raymond Hettinger [EMAIL PROTECTED] added the comment:
Patch attached.
--
assignee: rhettinger - georg.brandl
keywords: +patch
Added file: http://bugs.python.org/file11810/dequedoc.diff
___
Python tracker [EMAIL PROTECTED]
Benjamin Peterson [EMAIL PROTECTED] added the comment:
Done in r66913.
--
nosy: +benjamin.peterson
resolution: - fixed
status: open - closed
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4123
New submission from paul rubin [EMAIL PROTECTED]:
This is observed in Python 2.5.1, I haven't tried any later versions.
d = collections.deque(xrange(10))
random.shuffle(d)
is quite slow. Increasing the size to 200k, 300k, etc. shows that the
runtime increases quadratically or worse. It's