On Nov 19, 3:24 pm, Joshua Bronson <jabron...@gmail.com> 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? Comments and suggestions welcome.
Apart from the GPL, it seems perfectly fine to release, and looks like an interesting strategy. I've wanted one of those once in a while, never enough to bother looking for one or writing one myself. But you should absolutely not inherit from dict if you're overriding all it's methods. It's useless and wasteful to do that, perhaps dangerous. You end up using bytes for a small hash table that's never used. Plus Python 3 has a notion of Abstract Base Classes: it will allow customization of isinstance to advertise that your class implements MutableMapping, which is the right way to do it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list