Am 04.11.15 um 04:48 schrieb Steven D'Aprano:
On Wednesday 04 November 2015 11:33, ru...@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.
You *know* that they are not equivalent, I assume? regexes are
equivalent to finite state machines, which are less powerful than Turing
machines, and even less powerful than stack machines. You can't even
construct a regexp which validates, if parentheses are balanced.
What rurpy meant, was that regexes can surface to a computer user
earlier than variables and branches; a user who does not go into the
depth to actually program the machine, might still encounter them in a
text editor or database engine. Even some web forms allow some limited
form, like e.g. the DVD rental here or Google.
Christian
--
https://mail.python.org/mailman/listinfo/python-list