Which regex syntax mode?

Kragen Sitaker kragen at dnaco.net
Sat Sep 16 18:12:59 EDT 2000


In article <LNBBLJKPBEHFEDALKOLCCEDCHGAA.tim_one at email.msn.com>,
Tim Peters <tim_one at email.msn.com> wrote:
>So get familiar with the "string" module soon.  People use that instead
>whenever they can; it's considered clearer by everyone, and is generally
>faster.  At the extreme, I've seen Perl like
>
>    if ($var =~ /^a$/) { ... }
>
>and that's just unthinkable here.

It may be unthinkable in Python, but it's dumb in Perl, too ---

> In Python everyone would write
>
>    if var == "a":
>        ...
>
>instead.

I wish people would write that in Perl, too.  $var eq 'a'.

>  Besides being clearer to the lazy Python eye, a real advantage is
>that the Python spelling doesn't match "a\n" too by mistake <wink>.

The more I write Python, the less I miss Perl.  :)

wishing-he-had-a-sense-of-humor-ly y'rs  - kragen
-- 
<kragen at pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Perilous to all of us are the devices of an art deeper than we ourselves
possess.
                -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the Rings"]



More information about the Python-list mailing list