A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-December/070200.html below:

[Python-Dev] a feature i'd like to see in python #2: indexing of match objects

[Python-Dev] a feature i'd like to see in python #2: indexing of match objects [Python-Dev] a feature i'd like to see in python #2: indexing of match objectsGregory P. Smith greg at electricrain.com
Mon Dec 4 23:10:59 CET 2006
On Sun, Dec 03, 2006 at 07:38:21PM +0100, "Martin v. L?wis" wrote:
> Aahz schrieb:
> >>> this one is fairly simple.  if `m' is a match object, i'd like to be
> >>> able to write m[1] instead of m.group(1). (similarly, m[:] should return
> >>> the same as list(m.groups()).) this would remove some of the verbosity
> >>> of regexp code, with probably a net gain in readability; certainly no loss.
> >> Please post a patch to sf.net/projects/python (or its successor).
> > 
> > Given the list of issues and subsequent discussion so far, I think a PEP
> > will be required.  This needs more documentation than the typical patch.
> 
> I disagree. So far, nobody has spoken against the proposed feature. It's
> really a small addition of a new method to an existing type. Entire
> classes have been added to the standard library without a PEP. People
> can still criticize the patch when its posted (and it's not clear that
> the OP is even willing to produce a patch).

Agreed.  Just implement it including test cases testing and demoing
the corner cases.  Making match objects have sequence and dict
behaviour for groups is imnsho just common sense.

-greg
More information about the Python-Dev 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