Commit 92bc647e authored by Andreas Jung's avatar Andreas Jung

- replaced explicit declaration of TupleType

- fixed broken except statement
parent 25ab7e2a
...@@ -14,12 +14,10 @@ ...@@ -14,12 +14,10 @@
Advanced sort support by Oleg Broytmann <phd@@phd.pp.ru> 23 Apr 2001 Advanced sort support by Oleg Broytmann <phd@@phd.pp.ru> 23 Apr 2001
eg Sort(sequence, (("akey", "nocase"), ("anotherkey", "cmp", "desc"))) eg Sort(sequence, (("akey", "nocase"), ("anotherkey", "cmp", "desc")))
$Id: SortEx.py,v 1.6 2002/09/24 22:06:27 jeremy Exp $ $Id: SortEx.py,v 1.7 2002/10/19 06:46:35 andreasjung Exp $
""" """
from types import TupleType
TupleType=type(())
def sort(sequence, sort=(), _=None, mapping=0): def sort(sequence, sort=(), _=None, mapping=0):
""" """
...@@ -108,7 +106,7 @@ def sort(sequence, sort=(), _=None, mapping=0): ...@@ -108,7 +106,7 @@ def sort(sequence, sort=(), _=None, mapping=0):
try: try:
if mapping: k = v[sort] if mapping: k = v[sort]
else: k = getattr(v, sort) else: k = getattr(v, sort)
except AttributeError, KeyError: k = None except (AttributeError, KeyError): k = None
if not basic_type(type(k)): if not basic_type(type(k)):
try: k = k() try: k = k()
except: pass except: pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment