|
1 """Add things to old Pythons so I can pretend they are newer.""" |
|
2 |
|
3 # pylint: disable-msg=W0622 |
|
4 # (Redefining built-in blah) |
|
5 # The whole point of this file is to redefine built-ins, so shut up about it. |
|
6 |
|
7 |
|
8 # Python 2.3 doesn't have `set` |
|
9 try: |
|
10 set = set # new in 2.4 |
|
11 except NameError: |
|
12 # (Redefining built-in 'set') |
|
13 from sets import Set as set |
|
14 |
|
15 |
|
16 # Python 2.3 doesn't have `sorted`. |
|
17 try: |
|
18 sorted = sorted |
|
19 except NameError: |
|
20 def sorted(iterable): |
|
21 """A 2.3-compatible implementation of `sorted`.""" |
|
22 lst = list(iterable) |
|
23 lst.sort() |
|
24 return lst |