[Patches] [ python-Patches-633374 ] nondestructive dict.popitem and Set.pop

noreply@sourceforge.net noreply@sourceforge.net
Mon, 04 Nov 2002 15:54:25 -0800


Patches item #633374, was opened at 2002-11-04 12:15
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=633374&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: John Williams (johnw42)
Assigned to: Nobody/Anonymous (nobody)
>Summary: nondestructive dict.popitem and Set.pop

Initial Comment:
This patch (relative to the latest Python CVS tree)
adds a "pickitem" method to the builtin dict class and
a "pick" method to the BaseSet class.  These methods
are analogs of "dict.popitem" and "Set.pop", but they
don't remove the item they return from the dict/set.

This patch *does not* update the documentation.

This is my system:
Linux 2.4.2-2 #1 i686 unknown


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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-04 18:54

Message:
Logged In: YES 
user_id=33168

Fixed the Summary, lest someone think you were making a
personal problem public. :-)

Seriously though...I haven't looked at the patch, but could
you explain the rationale/benefit?  Is this likely to be
useful to many people or is it fairly limited?  Couldn't you
do dict.items()[0] if you wanted a random value?



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

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