intersection, union, difference, symmetric difference for dictionaries
mauro
mauro at gmail.com
Tue Feb 25 17:02:01 EST 2014
More information about the Python-list mailing list
Tue Feb 25 17:02:01 EST 2014
- Previous message (by thread): intersection, union, difference, symmetric difference for dictionaries
- Next message (by thread): intersection, union, difference, symmetric difference for dictionaries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>
> {'A': 1} | {'A': 2}
>
> I would propose at least four:
>
> {'A': 1} # choose the LHS
> {'A': 2} # choose the RHS
> {'A': (1,2)} # a resulting pair of both
> set(['A']) # you did set-ops, so you get a set
The implementation should define if LHS or RHS and user should change the
order of operands depending on what he wants.
Your example (as well as a many questions in stackoverflow.com) shows
that there is some need for these operations, that implemented in C in
python library will be by far more CPU and memory efficient than
implemented as you did.
- Previous message (by thread): intersection, union, difference, symmetric difference for dictionaries
- Next message (by thread): intersection, union, difference, symmetric difference for dictionaries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list