intersection, union, difference, symmetric difference for dictionaries

mauro mauro at gmail.com
Tue Feb 25 23:03:59 CET 2014


Il Tue, 25 Feb 2014 22:02:01 +0000, mauro ha scritto:


>> {'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.

posting error, this entry was supposed to be a reply to Tim Chase's 
comment.



More information about the Python-list mailing list