Regular expressions
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Nov 3 22:48:21 EST 2015
On Wednesday 04 November 2015 11:33, rurpy at yahoo.com wrote:
>> Not quite. Core language concepts like ifs, loops, functions,
>> variables, slicing, etc are the socket wrenches of the programmer's
>> toolbox. Regexs are like an electric impact socket wrench. You can do
>> the same work without it, but in many cases it's slower. But you have to
>> learn the other hand tools first in order to really use the electric
>> driver properly (understanding torques, direction of threads, etc), lest
>> you wonder why you're breaking off so many bolts with the torque of the
>> impact drive.
>
> I consider regexs more fundemental
I'm sure that there are people who consider the International Space Station
more fundamental than the lever, the wedge and the hammer, but they would be
wrong too.
Given primitives for branching, loops and variables, you can build support
for regexes. Given regexes, how would you build support for variables?
Of course, you could easily prove me wrong. All you would need to do to
demonstrate that regexes are more fundamental than branching, loops and
variables would be to demonstrate that the primitive operations available in
commonly used CPUs are regular expressions, and that (for example) C's for
loop and if...else are implemented in machine code as regular expressions,
rather than the other way around.
--
Steve
More information about the Python-list
mailing list