[Python-checkins] python/nondist/peps pep-0000.txt, 1.316, 1.317 pep-0265.txt, 1.1, 1.2
rhettinger@users.sourceforge.net
rhettinger at users.sourceforge.net
Fri Jun 17 06:30:43 CEST 2005
Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28394
Modified Files:
pep-0000.txt pep-0265.txt
Log Message:
Record the rejection of PEP 265.
The requested functionality was largely fulfilled by Py2.4's sorted()
function. See Guido's 6/17/2005 note on python-dev.
Index: pep-0000.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v
retrieving revision 1.316
retrieving revision 1.317
diff -u -d -r1.316 -r1.317
--- pep-0000.txt 17 Jun 2005 02:13:11 -0000 1.316
+++ pep-0000.txt 17 Jun 2005 04:30:41 -0000 1.317
@@ -80,7 +80,6 @@
S 256 Docstring Processing System Framework Goodger
S 258 Docutils Design Specification Goodger
SD 262 Database of Installed Python Packages Kuchling
- S 265 Sorting Dictionaries by Value Griffin
S 266 Optimizing Global Variable/Attribute Access Montanaro
S 267 Optimized Access to Module Namespaces Hylton
S 268 Extended HTTP functionality and WebDAV Stein
@@ -200,6 +199,7 @@
SR 242 Numeric Kinds Dubois
SR 244 The `directive' Statement von Loewis
SR 259 Omit printing newline after newline GvR
+ SR 265 Sorting Dictionaries by Value Griffin
SD 269 Pgen Module for Python Riehl
SR 270 uniq method for list objects Petrone
SR 271 Prefixing sys.path by command line option Giacometti
@@ -307,7 +307,7 @@
SD 262 Database of Installed Python Packages Kuchling
SF 263 Defining Python Source Code Encodings Lemburg
SF 264 Future statements in simulated shells Hudson
- S 265 Sorting Dictionaries by Value Griffin
+ SR 265 Sorting Dictionaries by Value Griffin
S 266 Optimizing Global Variable/Attribute Access Montanaro
S 267 Optimized Access to Module Namespaces Hylton
S 268 Extended HTTP functionality and WebDAV Stein
Index: pep-0265.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0265.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pep-0265.txt 14 Aug 2001 23:07:17 -0000 1.1
+++ pep-0265.txt 17 Jun 2005 04:30:41 -0000 1.2
@@ -2,7 +2,7 @@
Title: Sorting Dictionaries by Value
Version: $Revision$
Author: g2 at iowegian.com (Grant Griffin)
-Status: Draft
+Status: Rejected
Type: Standards Track
Created: 8-Aug-2001
Python-Version: 2.2
@@ -17,6 +17,25 @@
both difficult for beginners to understand and cumbersome for all
to implement.
+BDFL Pronouncement
+
+ This PEP is rejected because the need for it has been largely
+ fulfilled by Py2.4's sorted() builtin function:
+
+ >>> sorted(d.iteritems(), key=itemgetter(1), reverse=True)
+ [('b', 23), ('d', 17), ('c', 5), ('a', 2), ('e', 1)]
+
+ or for just the keys:
+
+ sorted(d, key=d.__getitem__, reverse=True)
+ ['b', 'd', 'c', 'a', 'e']
+
+ Also, Python 2.5's heapq.nlargest() function addresses the common use
+ case of finding only a few of the highest valued items:
+
+ >>> nlargest(2, d.iteritems(), itemgetter(1))
+ [('b', 23), ('d', 17)]
+
Motivation
More information about the Python-checkins
mailing list