This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark
Recipients akuchling, amaury.forgeotdarc, jimjjewett, mark, pitrou, rsc, timehorse
Date 2008-05-28.13:38:41
SpamBayes Score 0.42183486
Marked as misclassified No
Message-id <1211981927.99.0.906667705305.issue2636@psf.upfronthosting.co.za>
In-reply-to
Content
AFAIK if you have a regex with named capture groups there is no direct
way to relate them to the capture group numbers.
You could do (untested; Python 3 syntax):

    d = {v: k for k, v in match.groupdict()}
    for i in range(match.lastindex):
         print(i, match.group(i), d[match.group(i)])

One possible solution would be a grouptuples() function that returned a
tuple of 3-tuples (index, name, captured_text) with the name being None
for unnamed groups.

Anyway, good luck with all your improvements, I will be especially glad
if you manage to do (2) and (8) (and maybe (3)).
History
Date User Action Args
2008-05-28 13:38:49marksetspambayes_score: 0.421835 -> 0.42183486
recipients: + mark, akuchling, jimjjewett, amaury.forgeotdarc, pitrou, rsc, timehorse
2008-05-28 13:38:48marksetspambayes_score: 0.421835 -> 0.421835
messageid: <1211981927.99.0.906667705305.issue2636@psf.upfronthosting.co.za>
2008-05-28 13:38:46marklinkissue2636 messages
2008-05-28 13:38:44markcreate