intersection, union, difference, symmetric difference for dictionaries

MRAB python at mrabarnett.plus.com
Tue Feb 25 18:25:06 EST 2014


On 2014-02-25 23:14, Ben Finney wrote:
> MRAB <python at mrabarnett.plus.com> writes:
>
>> On 2014-02-25 21:27, Ben Finney wrote:
>> > Peter Otten <__peter__ at web.de> writes:
>> >
>> >> mauro wrote:
>> >>
>> >> > - Dictionaries and sets are both accessed by key
>> >>
>> >> but sets have no values
>> >
>> > Or rather, sets *only* have values. Dictionaries have keys, sets do
>> > not have keys.
>> >
>> But a dictionary can have duplicate values, a set cannot.
>
> Yes. Your “but” implies you think that contradicts my statement; it
> doesn't. So I'm not sure what point you're making.
>
The keys of a dictionary must be unique, like a set. The values of a
dictionary don't have to be unique, unlike a set.



More information about the Python-list mailing list