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/070210.html below:

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

[Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objectsBen Wing ben at 666.com
Tue Dec 5 10:02:39 CET 2006
Fredrik Lundh wrote:
> Ka-Ping Yee wrote:
>
>   
>> I'd say, don't pretend m is a sequence.  Pretend it's a mapping.
>> Then the conceptual issues go away.
>>     
>
> almost; that would mean returning KeyError instead of IndexError for 
> groups that don't exist, which means that the common pattern
>
>      a, b, c = m.groups()
>
> cannot be rewritten as
>
>      _, a, b, c = m
>
> which would, perhaps, be a bit unfortunate.
>
> taking everything into account, I think we should simply map __getitem__ 
> to group, and stop there.  no len(), no slicing, no sequence or mapping 
> semantics.  if people want full sequence behaviour with len and slicing 
> and iterators and whatnot, they can do list(m) first.
>
>   
i'm ok either way -- that is, either with the proposal i previously 
published, or with this restricted idea.

ben
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