A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-September/009135.html below:

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

[Python-Dev] Bug #113254: pre/sre difference breaks pyclbr [Python-Dev] Bug #113254: pre/sre difference breaks pyclbrGuido van Rossum guido@beopen.com
Sat, 02 Sep 2000 12:18:48 -0500
> 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?

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.

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4