Michael Selik added the comment:

Yesterday I wanted to do a destructuring bind on a slice of groups in a 
finditer. Similar situation to the use case of Issue #24454. It might not be 
"normal code" but I end up in that situation every month or so when parsing 
semi-structured documents. I found myself wishing for a mapping-destructuring 
bind, but that's another story.

I haven't read the full discussion of ``len`` on MatchObject yet, but I 
tentatively agree with Brandon Rhodes' comment in Issue #19536:

"My retort is that concentric groups can happen anyway:
that Group Zero, holding the entire match, is not really
as special as the newcomer might suspect, because you can
always wind up with groups inside of other groups; it is
simply part of the semantics of regular expressions that
groups might overlap or might contain one another ..."

@Serhiy, I was unaware of the feature of passing several arguments to groups. 
Unfortunately, the regex pattern I was using had a very large set of groups. A 
slice would have been particularly elegant. Passing several arguments to 
mo.groups() will be helpful, but still more awkward than a slice.

Perhaps it is a can of worms, but I was pleased to see indexing available and 
was disappointed not to find the typically supported corresponding features.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29965>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to