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

Josiah Carlson jcarlson at uci.edu
Fri Dec 8 17:38:29 CET 2006


Alastair Houghton <alastair at alastairs-place.net> wrote:
> On 7 Dec 2006, at 21:47, Josiah Carlson wrote:
> > If we were going to go with slicing, then it would be fairly  
> > trivial to
> > include the whole match range.  Some portion of the underlying  
> > structure
> > knows where the start of group 2 is, and knows where the end of  
> > group 5
> > is, so we can slice or otherwise use that for subsequent sliced  
> > groups.
> 
> But then you're proposing that this thing (which looks like a tuple,  
> when you're indexing it) should slice in a funny way.  i.e.

Let me be clear: I'm not proposing anything.  I have little to no
interest in seeing slices available to match objects, and as said in a
message 20 minutes prior to the message you are replying to, "Make the
slice return a list, don't allow slicing, or make it a full on group
variant. I don't really care at this point."

My statement in the email you replied to above was to say that if we
wanted it to return a group, then we could include subsequent .group(0)
with the same semantics as the original match object.

At this point it doesn't matter, Frederik will produce what he wants to
produce, and I'm sure most of us will be happy with the outcome.  Those
that are unhappy will need to write their own patch or deal with being
unhappy.


 - Josiah



More information about the Python-Dev mailing list