[Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
Fredrik Lundh
fredrik at pythonware.com
Thu Dec 7 18:43:36 CET 2006
Talin wrote:
> Maybe instead of considering a match object to be a sequence, a match
> object should be considered a map?
sure, except for one small thing. from earlier in this thread:
> 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.
to which I replied:
> 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.
</F>
More information about the Python-Dev
mailing list