Regular expressions

Chris Angelico rosuav at gmail.com
Wed Nov 4 09:52:08 EST 2015


On Thu, Nov 5, 2015 at 1:38 AM, rurpy--- via Python-list
<python-list at python.org> wrote:
> I'm afraid you are making a category error but perhaps that's in
> part because I wasn't clear.  I was not talking about computer
> science.  I was talking about human beings learning about computers.
> Most people I know consider programming to be a higher level activity
> than "using" a computer: editing, sending email etc.  Many computer
> users (not programmers) learn to use regular expressions as part
> of using a computer without knowing anything about programming.
> It was on that basis I called them more fundamental -- something
> learned earlier which is expanded on and added to later.  But you
> have a bit of a point, perhaps "fundamental" was not the best choice
> of word to communicate that.

The "fundamentals" of something are its most basic functions, not its
most basic uses. The most common use of a computer might be to browse
the web, but the fundamental functionality is arithmetic and logic.

Setting aside the choice of word, though, I still don't think regular
expressions are a more basic use of computing than loops and
conditionals. A regex can't be used for anything other than string
matching; they exist for one purpose, and one purpose only: to answer
the question "Does this string match this pattern?". Sure, you can
abuse that into a primality check and other forms of crazy arithmetic,
but it's not what they truly do. I also would not teach regexes to
people as part of an "introduction to computing" course, any more than
I would teach the use of Microsoft Excel, which some such courses have
been known to do. (And no, it's not because of the Microsoftness. I
wouldn't teach LibreOffice Calc either.) You don't need to know how to
work a spreadsheet as part of the basics of computer usage, and you
definitely don't need an advanced form of text search.

ChrisA



More information about the Python-list mailing list