Jon Clements wrote: > This probably isn't exactly what you want, but, unless you wanted to do > something especially with your own string class, I would just pass a > function to the sorted algorithm. > > eg: > > sorted( [a,b,c], cmp=lambda a,b: cmp(len(a),len(b)) ) > > gives you the below in the right order...
Or even better in 2.4 or later: sorted([a,b,c], key=len) George -- http://mail.python.org/mailman/listinfo/python-list