[Tutor] regexp

Asokan Pichai pasokan at talentsprint.com
Mon Nov 7 04:02:33 CET 2011


IMO the regex is not too bad; I will not use it for this job -- typing
a 50+ character string
is more painful (and more error prone) than writing 5--10 lines of code.

That said, if it made you look at regexes deeply and beyond the simple
explanation
of what each character (*, ., +) does I think the teacher ended up
making you learn
something.

FInally, the simplest NON-REGEX method is probably

isAlphaOrder(s):
      return sorted(s) == list(s)

It is useful learning to add default parameters to this
to improve the functionality to case-dependent or
case independent modes.

Happy learning

Asokan Pichai


More information about the Tutor mailing list