how to compare two strings?

Martin v. Loewis martin at v.loewis.de
Tue Feb 12 19:57:33 EST 2002


scarblac at pino.selwerd.nl (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).

Regards,
Martin



More information about the Python-list mailing list