Changeset 308
- Timestamp:
- 02/25/08 14:05:22 (5 years ago)
- Location:
- elixir/trunk/elixir
- Files:
-
- 2 modified
-
entity.py (modified) (1 diff)
-
py23compat.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/elixir/entity.py
r307 r308 4 4 ''' 5 5 6 from py23compat import set, rsplit 6 from py23compat import set, rsplit, sorted 7 7 8 8 import sys -
elixir/trunk/elixir/py23compat.py
r307 r308 13 13 # global name 'sorted' doesn't exist in Python2.3 14 14 # this provides a poor-man's emulation of the sorted built-in method 15 def sorted(l, kwargs): 16 if 'key' not in kwargs: 17 raise Exception('Our python 2.3 version of sorted needs a key kwarg argument') 18 key_func = kwargs['key'] 15 def sorted(l, **kwargs): 19 16 sorted_list = list(l) 20 sorted_list.sort(lambda self, other: cmp(key_func(self), 21 key_func(other))) 17 if 'key' in kwargs: 18 key_func = kwargs['key'] 19 sorted_list.sort(lambda self, other: cmp(key_func(self), 20 key_func(other))) 21 else: 22 sorted_list.sort() 22 23 return sorted_list 23 24
