Issue1814527

classification
Title: patch for [1803425], [1758322], [1785366] and upgraded sort
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: mehendran, pjenvey
Priority: normal Keywords: patch

Created on 2007-10-16.15:06:21 by mehendran, last changed 2008-01-27.06:40:37 by pjenvey.

Files
File name Uploaded Description Edit Remove
sort_funcs.diff mehendran, 2007-10-16.15:06:21 sort functions
Messages
msg2926 (view) Author: Mehendran (mehendran) Date: 2007-10-16.15:06:21
I have attached the patch file. This patch would solve
the following items.

[1803425]
---------
new builtin funcion :- sorted() - a new builtin sorted()

[1758322]
---------
List mutation during sort doesn't throw a ValueError

[1785366]
---------
list.sort should raise ValueError when modified during
sort. This is a dupe of #1758322

New or upgraded built-ins
-------------------------
# new sort() keyword arguments - list.sort() now accepts keyword arguments cmp, key and reverse
# sorted() - a new builtin sorted() acts like an in-place list.sort() but can be used in expressions, as it returns a copy of the sequence, sorted.
http://www.python.org/download/releases/2.4/highlights/

Please find the patch attached and give your valuable
comments.

Thanks,
Mehendran





msg2927 (view) Author: Mehendran (mehendran) Date: 2007-10-16.15:21:07
Please test the patch with the following test case files.
(1) test_sort.py
(2) test_builtin.py

test_sort.py is new and copied from Python-2.4.4/Lib/test/test_sort.py.
The following two test cases are excluded from the test run.
    del TestDecorateSortUndecorate.test_key_with_mutating_del
    del TestDecorateSortUndecorate.test_key_with_mutating_del_and_exception
because, user object is passed for "key" argument. That object has function
called __del__ that is mutating the data. It can't be checked as long as it
is invoked. I guess it needs some parsing effort before passing the object
to the sort. 






                 
msg2928 (view) Author: Philip Jenvey (pjenvey) Date: 2008-01-27.06:40:37
jbaker committed this to the modern branch, which was just merged to trunk

thanks a bunch mehendran! this was a fair piece of well needed functionality
History
Date User Action Args
2007-10-16 15:06:21mehendrancreate