set operations on dictionaries?

skip at pobox.com skip at pobox.com
Mon Oct 16 12:40:56 EDT 2006


    It should be quite obvious what should happen when the values stored for
    the relevant keys are identical. It is less obvious (and needs some
    though) what should happen when the keys are the same in the two
    operands, but the values are different.

I think you answered you own proposal in the negative.  Precisely because
the result of this example

    {1: 10, 2: 20} | {2: 25, 3:30}

is ill-defined, Python shouldn't implement set operations on dictionaries.

"In the face of ambiguity, refuse the temptation to guess."

Skip



More information about the Python-list mailing list