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

Tim Peters tim_one@email.msn.com
Sat, 2 Sep 2000 14:46:33 -0400

[start/end (group)  documented to return None for group that
 didn't participate in the match
 sre does this
 pre actually returned -1
 this breaks pyclbr.py
 Guido sez pre's behavior is better & the docs should be changed

> 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?)

Good point.  pyclbr got changed last year, to speed it and make it more robust for IDLE's
class browser display.  Which has another curious role to play in this screwup!  When
rewriting pyclbr's parsing, I didn't remember what start(group) would do for a
non-existent group.  In the old days I would have looked up the docs.  But since I had
gotten into the habit of *living* in an IDLE box all day, I just tried it instead and
"ah! -1 ... makes sense, I'll use that" was irresistible.  Since any code relying on the
docs would not have worked (None is the wrong type, and even the wrong value viewed as
boolean), the actual behavior should indeed win here.