[Python-ideas] What about regexp string litterals : re".*" ?

Chris Angelico rosuav at gmail.com
Wed Mar 29 21:51:43 EDT 2017


On Thu, Mar 30, 2017 at 12:47 PM, Abe Dillon <abedillon at gmail.com> wrote:
>> I feel like that borders on a bit too wordy...
>
>
> I think the use of words instead of symbols is one of the things that makes
> Python so readable. The ternary operator is done with words:
>
> value = option1 if condition else option2
>
> reads almost like English, while:
>
> value = condition ? option1: option2;
>
> Is just weird.
>
> I can read Verbal Expressions very quickly and understand exactly what's
> going on. If I have a decent IDE, I can write them almost as easily. I see
> no problem with wordiness if it means I don't have to stare at the code and
> scratch my head longer, or worse, open a reference to help me translate it
> (which is invariably the case when I look at regular expressions).

However, a huge advantage of REs is that they are common to many
languages. You can take a regex from grep to Perl to your editor to
Python. They're not absolutely identical, of course, but the basics
are all the same. Creating a new search language means everyone has to
learn anew.

ChrisA


More information about the Python-ideas mailing list