[Patches] [ python-Patches-682420 ] new dictionary method: pop()

SourceForge.net noreply@sourceforge.net
Fri, 07 Feb 2003 08:51:45 -0800


Patches item #682420, was opened at 2003-02-07 17:51
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=682420&group_id=5470

Category: Library (Lib)
Group: Python 2.2.x
Status: Open
Resolution: None
Priority: 5
Submitted By: Michal Vitecek (fufsource)
Assigned to: Nobody/Anonymous (nobody)
Summary: new dictionary method: pop()

Initial Comment:
the attached patch (against vanilla 2.2.2) adds a new
method (pop()) to the builtin dictionary. the method
simply returns the value stored at the specified key
and removes the pair from the dictionary, ie:

>>> a = {10:12, 6:8}
>>> a.pop(10)
12
>>> a
{6: 8}

i think it's useful because a) the same method exists
for lists, b) one doesn't have to always write 'v =
a[10]; del a[10]' which requires two lookups.

i can make a patch for 2.3.x as well if anyone's
interested.

thank you for consideration.

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

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