The Alphanum Algorithm in Python

From: mvale… (Mario Valente)
Newsgroups: mv
Subject: The Alphanum Algorithm in Python
Date: Wed, 12 Dec 07 01:12:21 GMT

And, in a heroic session of coding (the last couple of
hours really; yes, it took me that long, goddam regular
expressions…) the geezer comes up with the Python
version of the Alphanum algorithm…

The Alphanum Algorithm

Alphanum Algorithm in Python

Yay for me, I still remember how to code….

— MV

PS – Yes, I later found the solution below but I had fun meanwhile…

def safeint(x):
return int(x)
except ValueError:
return x
data.sort(key=lambda x: map(safeint, re.findall(“\d+|\D+”, x)))

Comments are closed.