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 serhiy.storchaka
Recipients ezio.melotti, mrabarnett, rhettinger, serhiy.storchaka
Date 2015-06-15.04:29:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1434342568.32.0.199956771478.issue24454@psf.upfronthosting.co.za>
In-reply-to
Content
You can use mo.groupdict().

  print('Located coordinate at (%(row)s, %(col)s)' % mo.groupdict())
  print('Located coordinate at ({row}, {col})'.format_map(mo.groupdict()))

As for len(mo), this is ambiguous, as well as indexing with integer indices. You suggest len(mo) be equal len(mo.groups()) and this looks reasonable to me, but in regex len(mo) equals to len(mo.groups())+1 (because mo[1] equals to mo.group(1) or mo.groups()[0]). If indexing will work only with named groups, it would be expected that len(mo) will be equal to len(mo.groupdict()).
History
Date User Action Args
2015-06-15 04:29:28serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, ezio.melotti, mrabarnett
2015-06-15 04:29:28serhiy.storchakasetmessageid: <1434342568.32.0.199956771478.issue24454@psf.upfronthosting.co.za>
2015-06-15 04:29:28serhiy.storchakalinkissue24454 messages
2015-06-15 04:29:27serhiy.storchakacreate