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
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