python bijection
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Thu Nov 19 19:05:45 EST 2009
On Thu, 19 Nov 2009 15:24:46 -0800, Joshua Bronson wrote:
> I couldn't find a library providing a bijective map data structure
> (allowing for constant-time lookups by value) in the few minutes I
> looked, so I took a few more minutes to code one up:
> http://bitbucket.org/jab/toys/src/tip/bijection.py
>
> Is this at all worth releasing?
You just did :)
> Comments and suggestions welcome.
If I want a mapping a <-> b, I generally just create a dict {a:b, b:a}.
What is the advantages or disadvantages of your code over the simplicity
of the dict approach?
(That is, sell us on the features of your approach.)
--
Steven
More information about the Python-list
mailing list