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.

</F>

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to