Two mappings inverse to each other: f, g = biject()

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Tue Feb 6 15:56:45 EST 2007


Jonathan Fine:
> A google search for biject.py and bijection.py
> produced no hits, so I suspect that this may not
> have been done before.

There are few (good too) implementations around, but they are called
bidict or bidirectional dicts. Sometimes I use this implementation,
with few changes:
http://www.radlogic.com.au/releases/two_way_dict.py

Bye,
bearophile




More information about the Python-list mailing list