Message200356
I discussed this briefly with Serhiy on IRC and I think the repr can be improved.
Currently it looks like:
>>> re.compile(r'[/\\]([.]svn)').match('/.svn')
<_sre.SRE_Match object: groups=1, span=(0, 5), group0='/.svn'>
One problem is that the group count doesn't include group 0, so from the example repr one would expect that the info are about the 1 (and only) group in "groups=", whereas that is actually group 0 and there's an additional group 1 that is not included in the repr.
A possible solution is to separate the group count from the info about group 0:
<_sre.SRE_Match object (1 group); group0='/.svn', span=(0, 5)>
To make things even less confusing we could avoid calling it group0 and use something like "match=", or alternatively remove the group count (doesn't the count depend only on the regex, and not on the string?). |
|
Date |
User |
Action |
Args |
2013-10-19 01:40:32 | ezio.melotti | set | recipients:
+ ezio.melotti, rhettinger, mrabarnett, chris.jerdonek, Claudiu.Popa, serhiy.storchaka |
2013-10-19 01:40:32 | ezio.melotti | set | messageid: <1382146832.15.0.886075870717.issue17087@psf.upfronthosting.co.za> |
2013-10-19 01:40:32 | ezio.melotti | link | issue17087 messages |
2013-10-19 01:40:31 | ezio.melotti | create | |
|