Question about scientific calculations in Python
Courageous
jkraska at san.rr.com
Wed Mar 13 20:33:28 EST 2002
>in Python. Best I think would be a standard module of data structures
>(priority queue, doubly-linked lists, stack, etc.) But it hasn't bothered
>me enough to go ahead and do it.
I have implemented a deque (which safely supports insert on iteration
with multiple iterators using a fail-fast protocol), a priority queue
(which isn't entirely generalized, I believe it assumes an integer and
organizes top for lowest numbers), and a thing that I call a "double
vector" which, like vectors with preallocation strategies, supports both
preallocation of memory at the head _AND_ the tail, giving it deque-like
properties without the support for insert-on-iterate.
It's all been reasonably well-tested.
I'll gladly contribute all this to a larger collection library if someone
wants to organize it.
Downsides: the iterators are older and not related to Python's new
iterators. It doesn't really matter which container you use as far as
performance goes, for routinely-encountered values of N. That's why
Python doesn't have anything special like this built in already, actually.
C//
More information about the Python-list
mailing list