Convert from numbers to letters
Bill Mill
bill.mill at gmail.com
Thu May 19 15:39:59 EDT 2005
On 19 May 2005 12:20:03 -0700, rh0dium <sklass at pointcircle.com> wrote:
> Python 2.3.5 (#1, Mar 20 2005, 20:38:20)
> [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> NameError: name 'sorted' is not defined
>
> I think you're probably using 2.4 ??
Yes, sorted() is new in python 2.4 .You could use a very lightly
tested pure-python partial replacement:
def sorted(lst, **kwargs):
l2 = lst[:]
if kwargs.has_key('key'):
f = kwargs['key']
l2.sort(lambda a,b: cmp(f(a), f(b)))
return l2
l2.sort()
return l2
And from your other email:
> I need to go the other way! tuple2coord
Sorry, I only go one way. It should be transparent how to do it backwards.
Peace
Bill Mill
bill.mill at gmail.com
More information about the Python-list
mailing list