[Python-Dev] Bug #113254: pre/sre difference breaks pyclbr

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Sat, 2 Sep 2000 18:05:33 +0200


paul prescod spotted this discrepancy:

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

unlike SRE:

>>> import sre
>>> m = sre.match("(a)|(b)", "b")
>>> m.start(1)
>>> print m.start(1)
None

this difference breaks 1.6's pyclbr (1.5.2's pyclbr works
just fine with SRE, though...)

:::

should I fix SRE and ask Fred to fix the docs, or should
someone fix pyclbr and maybe even PCRE?

</F>