DebugClients/Python3/coverage/backward.py

changeset 0
de9c2efb9d02
child 29
391dc0bc4ae5
diff -r 000000000000 -r de9c2efb9d02 DebugClients/Python3/coverage/backward.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DebugClients/Python3/coverage/backward.py	Mon Dec 28 16:03:33 2009 +0000
@@ -0,0 +1,24 @@
+"""Add things to old Pythons so I can pretend they are newer."""
+
+# pylint: disable-msg=W0622
+# (Redefining built-in blah)
+# The whole point of this file is to redefine built-ins, so shut up about it.
+
+
+# Python 2.3 doesn't have `set`
+try:
+    set = set       # new in 2.4
+except NameError:
+    # (Redefining built-in 'set')
+    from sets import Set as set
+
+
+# Python 2.3 doesn't have `sorted`.
+try:
+    sorted = sorted
+except NameError:
+    def sorted(iterable):
+        """A 2.3-compatible implementation of `sorted`."""
+        lst = list(iterable)
+        lst.sort()
+        return lst

eric ide

mercurial