[Patches] [ python-Patches-597444 ] Speed-up sets

noreply@sourceforge.net noreply@sourceforge.net
Mon, 19 Aug 2002 15:59:00 -0700


Patches item #597444, was opened at 2002-08-19 17:57
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=597444&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Speed-up sets

Initial Comment:
Gained a 5:1 speed-up for membership testing by 
handling the most common case first (the case 
where the element is hashable).

Also, renamed the popitem() method to pop() for 
consistency with list.pop and dict.pop(k).  The 'item' 
in popitem suggests that a tuple will be returned.

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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2002-08-19 17:59

Message:
Logged In: YES 
user_id=80475

Attached a script that verifies the claimed timing speed-up.

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

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