write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

Chris Angelico rosuav at gmail.com
Sat Sep 29 19:26:20 EDT 2012


On Sun, Sep 30, 2012 at 6:51 AM, Tim Delaney
<timothy.c.delaney at gmail.com> wrote:
> Personally I voted for the Fierce Snake[1][2] as the delimiter, but it was
> voted down as "not Pythonic" enough.
> I'm sure they were using that as a euphamism for "Python*ish*" though.
>
> [1] https://en.wikipedia.org/wiki/Inland_Taipan
> [2] It's is so pretty:
> https://upload.wikimedia.org/wikipedia/commons/f/fe/Fierce_Snake-Oxyuranus_microlepidotus.jpg

A tempting idea, but it's rather a large delimiter. We should reserve
that for multi-line strings, I think. Although you may have a problem
with i18n; when you take your code to the southern hemisphere, the
snake will be facing the other way, so what you thought was an
open-quote marker is now a close-quote marker instead. Could get
awkward for naive coders.

ChrisA



More information about the Python-list mailing list