[Python-ideas] This seems like a wart to me...
skip at pobox.com
skip at pobox.com
Fri Dec 12 16:14:34 CET 2008
>> what you meant was "I can't imagine new programmers wanting to go
>> into the re module to learn how to do something like
>> string.splitonchars." To which I say: Yes! I heartily agree! :-D
Steve> I don't understand this point of view at all. True, regexps are
Steve> a complex subject, with an unfortunately large number of
Steve> dialects. Is it the confusion of dialects problem, or do you
Steve> really never use regexps in any language?
Getting more than a little bit off the original topic, but... I think a
person's affinity for regular expressions has a lot to do with their editing
& programming environments. I work with some very experienced programmers
(C++ & Python mostly, not much Perl, and generally very basic Emacs usage)
who never (or almost never) use regular expressions.
* C/C++: My impression was always that the C regex(3) API presented a lot of
barriers to casual use. Maybe that's changed over time.
* Python: You can go a long way without using regular expressions in Python
because it has other easy-to-use string searching stuff (str.find, etc) as
well as shell-style globbing for file name matching.
* Emacs: I think part of the reason that I find re's so easy-to-use is that
I've been using some dialect of Emacs for about 20 years and it exposes
re's in a way that is real easy to experiment with: incremental search.
i-search+re's - what a fabulous combination.
* Perl: I suspect Perl mongers are as adept at re's as Emacs types because
that's the primary (only?) way to search for patterns in strings.
* vi: Probably somewhere between Perl and Emacs. vim does support
incremental search but it's not the default.
Are there other editors besides Emacs and vi for which regular expressions
are so common?
Bringing this back on-topic, I can see that I'm going to lose this argument.
I still view "".split(':') as a wart. I guess I'll have to live with it
More information about the Python-ideas