Reinhold Birkenfeld writes:
And it's horrible, for none of the other string methods accept a RE.
I suppose it depends on your perspective as to what exactly is horrible. I tend to think it's too bad that none of the other string methods accept appropriate RE patterns. Strings are thought of as "core", whereas RE, a relatively new part of the stdlib, isn't. But it's OK -- it just gives the system more Java-ness, where you have lots of little modules, each of which does something slightly different.
There are languages which give REs too much weight by philosophy (hint, hint), but Python isn't one of them. Interestingly, Python programmers suffer less from the "help me, my RE doesn't work" problem.
Yes, but perhaps the causative bug in those "other" languages is the confusion between string *literals* and RE *literals*, which isn't a problem in the idiom I suggested.
Or perhaps if RE was more helpful in Python, Python programmers would indeed suffer from the same problem.