[Python-bugs-list] [ python-Bugs-643115 ] Creating sets from dictionaries

noreply@sourceforge.net noreply@sourceforge.net
Sun, 24 Nov 2002 20:02:52 -0800


Bugs item #643115, was opened at 2002-11-24 10:54
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=643115&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Martin v. L÷wis (loewis)
Assigned to: Nobody/Anonymous (nobody)
Summary: Creating sets from dictionaries

Initial Comment:
When creating a set from a dictionary, the dictionary
values must not be copied. The following expression
gives, False, but should give True, since both sets
contain the same elements.

>>> from sets import Set
>>> Set({10:10}) == Set([10])
False


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2002-11-24 23:02

Message:
Logged In: YES 
user_id=80475

There are two ways to go with this one.  Either follow the 
OP suggestion and force all values to be True, or revise the 
equality tests to only compare keys.

I like the second approach but am posting patches for 
both.  If one or the other is approved, will add the failure 
to the test_suite.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=643115&group_id=5470