python bijection

Joshua Bronson jabronson at gmail.com
Wed Dec 2 18:21:33 EST 2009


On Dec 1, 8:17 pm, aahz at pythoncraft.com (Aahz) wrote:
> In article <85100df7-a8b0-47e9-a854-ba8a8a2f3b98 at r31g2000vbi.googlegroups.com>,
> Joshua Bronson  <jabronson at gmail.com> wrote:
> >I noticed the phonebook example in your ActiveState recipe and thought
> >you might consider changing it to something like husbands to wives,
> >since the names-to-phone-numbers relation is many-to-many.
>
> What makes you think husbands to wives is one-to-one?  ;-)  (Even
> assuming monogamy, you have husbands-to-husbands and wives-to-wives.)

Hah! I knew this was coming and even put "assuming monogamy" in the
source!
http://bitbucket.org/jab/bidict/src/712da6e2dd26/bidict.py#cl-65  ;P

As for husbands-to-husbands and wives-to-wives, those are just
separate one-to-one mappings! Doesn't mean husbands-to-wives ain't one-
to-one!

At any rate, apologies to the community for my heteronormative
example. It was merely pedagogical and reflects nothing about my
personal views! If you have any further concerns, please send them to
my lawyer, /dev/null.



More information about the Python-list mailing list