[Python-Dev] Bug #113254: pre/sre difference breaks pyclbr
Fredrik Lundh" <email@example.com
Sat, 2 Sep 2000 18:54:57 +0200
> > from the documentation:
> > start ([group])
> > end ([group])
> > Return the indices of the start and end of the
> > substring matched by group; group defaults to
> > zero (meaning the whole matched substring). Return
> > None if group exists but did not contribute to the
> > match.
> > however, it turns out that PCRE doesn't do what it's
> > supposed to:
> > >>> import pre
> > >>> m = pre.match("(a)|(b)", "b")
> > >>> m.start(1)
> > -1
> I'd suggest fix SRE and the docs, because -1 is a more useful
> indicator for "no match" than None: it has the same type as valid
> indices. It makes it easier to adapt to static typing later.
sounds reasonable. I've fixed the code, leaving the docs to Fred.
this should probably go into 1.6 as well, since pyclbr depends on
it (well, I assume it does -- the pyclbr in the current repository
does, but maybe it's only been updated in the 2.0 code base?)