This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: SimpleSets
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
Status: closed Resolution: later
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, rhettinger
Priority: normal Keywords: patch

Created on 2002-11-14 01:24 by rhettinger, last changed 2022-04-10 16:05 by admin. This issue is now closed.

File name Uploaded Description Edit rhettinger, 2002-11-14 01:24
Messages (2)
msg41646 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002-11-14 01:24
In the spirit of heapq for lists, this module provides 
set operations for dictionaries.

-- lightweight, fast, and easy to learn
-- works well with any iterable input
-- takes advantage of the existing implementation

-- does not support sets of sets
-- need to wrap sets in list() before displaying
-- no operators

This lightweight module (80 lines of code) is meant to 
be a convenient, fast solution for daily tasks which do 
not require the full firepower of the heavyweight Sets 

print 'IsSet', isset('factoid'), isset('misinformation')
print 'Equals', equals('algorithm','logarithm'), equals
print 'Subset', issubset('heart', 'thread'), issubset
a = 'abracadabra'
b = 'alacazam'
print 'Union', list(union(a,b))
print 'Intersection', list(intersection(a,b))
print 'Difference', list(difference(a,b))
print 'SymmetricDifference', list(symmetric_difference
print 'Uniquification', list(set(a))
print 'Cardinality', len(set(a))
print 'Iteration', [letter.upper() for letter in set(a)]
print 'Membership', 'b' in set(a), 'e' in set(a)

msg41647 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2002-11-23 01:33
Logged In: YES 

I personally don't see the need for this.  Basically
everything here can already be done if you are willing to
create a set first and then use the set's methods.  Yes,
there might be a performancce difference if you are using a
dictionary, but if this functionality is really needed for
dicts perhaps it should be added to dicts themselves.  I
just  don't see any special reason to add this since this is
all easily done enough using sets.

Perhaps a PEP is in order to get this in?
Date User Action Args
2022-04-10 16:05:53adminsetgithub: 37470
2002-11-14 01:24:09rhettingercreate