summaryrefslogtreecommitdiff
path: root/argparse.py
diff options
context:
space:
mode:
Diffstat (limited to 'argparse.py')
-rw-r--r--argparse.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/argparse.py b/argparse.py
index 36e54c4..3457867 100644
--- a/argparse.py
+++ b/argparse.py
@@ -93,10 +93,22 @@ from gettext import gettext as _
try:
set
except NameError:
- # for python < 2.5 compatibility (sets module is there since 2.3):
+ # for python < 2.4 compatibility (sets module is there since 2.3):
from sets import Set as set
+try:
+ sorted
+except NameError:
+ # for python < 2.4 compatibility:
+ def sorted(iterable, reverse=False):
+ result = list(iterable)
+ result.sort()
+ if reverse:
+ result.reverse()
+ return result
+
+
def _callable(obj):
return hasattr(obj, '__call__') or hasattr(obj, '__bases__')