[issue10059] add the method `index` to collections.deque

2010-10-10 Thread Simon Liedtke
Simon Liedtke added the comment: I see that adding this method to a deque is useless. A list is better for this kind of operation. I just wrote it for fun and realized that it was implemented rather slow. -- resolution: -> rejected status: open -> closed

[issue10059] add the method `index` to collections.deque

2010-10-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Hello Simon, Accessing an arbitrary element of a deque takes O(n) time, making your .index implementation O(n**2). If you describe the kinds of operations that you need to perform efficiently, we may be able to suggest a better data structure for you to us

[issue10059] add the method `index` to collections.deque

2010-10-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: The absence of index() from collections deque wasn't an oversight. Deques are not really about indexed access, they are about appending and popping from the ends. I'm curious about your use case and whether it is a good match for this data structure. --

[issue10059] add the method `index` to collections.deque

2010-10-09 Thread Ned Deily
Ned Deily added the comment: Since you are requesting adding a method to an existing data type, you should probably raise this issue first on the python-ideas mailing list and be prepared to justify use cases for it. http://mail.python.org/mailman/listinfo/python-ideas -- nosy: +ned.

[issue10059] add the method `index` to collections.deque

2010-10-09 Thread Simon Liedtke
New submission from Simon Liedtke : I'd like to have the method `index` not only for list, but also for collections.deque. Here is my attempt: http://bitbucket.org/derdon/hodgepodge/src/tip/extended_deque.py I'm looking forward to see this method implemented in the stdlib! -- compone