Missing collections

B

Bearophile

What are the useful collections that are missing in the collections
module?

Let's see:
- sortedDict, sortedSet (based on a search tree)
- frozenDict
- bitArray (or bitset)
- graph
- linkedList (*)

(*) linkedList is like deque, it's a linked list of short arrays, but
they aren't 100% full.

Few more that are less important:
- biDict (bidirectional dict, a bijection)
- persistentList, persistentDict
- intervalDict
- Trie
- Dawg
- Rope
- Fibonacci heap
- Bloom filter
- Union-Find

With those I think many things are covered :)

Regarding the standard library of Python 3, it's easy enough to create
for mistake a module and have it collide with an equally named module
of the std lib. To avoid this I think (after seeing the std lib of the
D language) it can be useful to put all modules of the standard
library into a namespace, like "py" or "std" or something like that.
So you write:

import py.math
from py.math import sin

x = py.math.cos(1.2)
y = sin(1.2)

Bye,
bearophile
 
L

Lie Ryan

- frozenDict

perhaps we could extend namedtuple to become the "frozenDict"
- persistentList, persistentDict

aren't they database? Am I missing something here?
Regarding the standard library of Python 3, it's easy enough to create
for mistake a module and have it collide with an equally named module
of the std lib. To avoid this I think (after seeing the std lib of the
D language) it can be useful to put all modules of the standard
library into a namespace, like "py" or "std" or something like that.

if it were to happen, it would take python 4 or python 5 and the idea's
runner must beat Guido down from his throne first... I think... not that
they weren't a good idea... and other python implementations might want
their own namespace as well to contain implementation specific modules
(imagine "ipy", "cy", "us", "aspn", etc popping up here and there).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top