A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/063409.html below:

Dive Into Python: call for comments (long)

Dive Into Python: call for comments (long)Steve Lamb grey at despair.rpglink.com
Mon Apr 23 20:48:24 EDT 2001
On Mon, 23 Apr 2001 18:50:23 -0400, Mark Pilgrim <f8dy at diveintopython.org>
wrote:
>romanNumeralPattern = \
>    re.compile('^M{0,3}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$')

>Is this more efficient?  It is more elegant (as regular expressions go)?
>Any regular expression experts care to comment?

    Well, generally {}'s are less efficient but a little easier to read.
OTOH, define "efficiency" as "easier to read" and yes, it is.  

    The only other thing my admittedly limited regex mind can see is changing
the ()s to be (?:)s unless you're explcitely matching them for later use.  But
I'm sure many people will take issue to that for a variety of good reasons.
:)

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4