Message291087
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. |
|
Date |
User |
Action |
Args |
2017-04-03 17:58:40 | selik | set | recipients:
+ selik, eric.smith, ezio.melotti, mrabarnett, serhiy.storchaka, xiang.zhang |
2017-04-03 17:58:40 | selik | set | messageid: <1491242320.87.0.218566357848.issue29965@psf.upfronthosting.co.za> |
2017-04-03 17:58:40 | selik | link | issue29965 messages |
2017-04-03 17:58:40 | selik | create | |
|