Guido grants a Christmas wish:

sorted() becomes a regular function instead of a classmethod.
This commit is contained in:
Raymond Hettinger 2003-12-17 20:43:33 +00:00
parent df38ea9c29
commit 64958a15d7
15 changed files with 120 additions and 138 deletions

View file

@ -263,7 +263,7 @@ class OperatorTestCase(unittest.TestCase):
inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)]
getcount = operator.itemgetter(1)
self.assertEqual(map(getcount, inventory), [3, 2, 5, 1])
self.assertEqual(list.sorted(inventory, key=getcount),
self.assertEqual(sorted(inventory, key=getcount),
[('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)])
def test_main():