how to compare two strings?

Martin v. Loewis martin at
Wed Feb 13 01:57:33 CET 2002

scarblac at (Remco Gerlich) writes:

> >   def scmp(a,b):
> >     if a<b: return -1
> >     if b<a: return 1
> >     return 0
> Uhm. scmp() is the same as the builtin cmp(), as far as I can see.

Almost, yes. It performs two comparisons, though, whereas the builtin
performs only one (in general).


More information about the Python-list mailing list