summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn R. Lenton <jlenton@gmail.com>2014-01-07 17:29:16 +0000
committerJohn R. Lenton <jlenton@gmail.com>2014-01-07 17:29:16 +0000
commitc06763a0207dde7f2060f7b1670a0b99298a01f8 (patch)
tree2f28c6e8824849f167a9b133c2d23c3c55c727d9 /tests
parent880ce2d7fabc127b4bca7b6f2ea8b82d0977045f (diff)
This implements a better (more python-conformant) list.sort.
It's not really about that, though; it's about me figuring out a sane way forward for keyword-argument functions (and function metadata). But it's useful as is, and shouldn't break any existing code, so here you have it; I'm going to park it in my mind for a bit while sorting out the rest of the dict branch.
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/tests/list_sort.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/basics/tests/list_sort.py b/tests/basics/tests/list_sort.py
new file mode 100644
index 000000000..eff12b9c8
--- /dev/null
+++ b/tests/basics/tests/list_sort.py
@@ -0,0 +1,13 @@
+l = [1, 3, 2, 5]
+print(l)
+l.sort()
+print(l)
+l.sort(key=lambda x: -x)
+print(l)
+l.sort(key=lambda x: -x, reverse=True)
+print(l)
+l.sort(reverse=True)
+print(l)
+l.sort(reverse=False)
+print(l)
+