Why re.match()?

kj no.email at please.post
Wed Jul 1 13:56:55 EDT 2009



For a recovering Perl-head like me it is difficult to understand
why Python's re module offers both match and search.  Why not just
use search with a beginning-of-string anchor?  I find it particularly
puzzling because I have this (possibly mistaken) idea that the
Python design philosophy tends towards minimalism, a sort of Occam's
razor, when it comes to language entities; i.e. having re.match
along with re.search seems to me like an "unnecessary multiplication
of entities".  What am I missing?

TIA!

kj



More information about the Python-list mailing list