[Python-Dev] Remove str.find in 3.0?

Raymond Hettinger raymond.hettinger at verizon.net
Sat Aug 27 10:20:38 CEST 2005


> > The most important reason for the patch is that looking at the
context
> > diff will provide an objective look at how real code will look
before
> > and after the change.  This would make subsequent discussions
> > substantially more informed and less anecdotal.
> 
> No, you're just artificially trying to raise the bar for Python 3.0
> proposals to an unreasonable height.

Not really.  I'm mostly for the proposal (+0), but am certain the
conversation about the proposal would be substantially more informed if
we had a side-by-side comparison of what real-world code looks like
before and after the change.  There are not too many instances of
str.find() in the library and it is an easy patch to make.  I'm just
asking for a basic, objective investigative tool.

Unlike more complex proposals, this one doesn't rely on any new
functionality.  It just says don't use X anymore.  That makes it
particularly easy to investigate in an objective way.

BTW, this isn't unprecedented.  We're already done it once when
backticks got slated for removal in 3.0.  All instances of it got
changed in the standard library.  As a result of the patch, we were able
to 1) get an idea of how much work it took, 2) determine every category
of use case, 3) learn that the resulting code was more beautiful,
readable, and only microscopically slower, 4) learn about a handful of
cases that were unexpectedly difficult to convert, and 5) update the
library to be an example of what we think modern code looks like.  That
patch painlessly informed the decision making and validated that we were
doing the right thing.

The premise of Terry's proposal is that Python code is better when
str.find() is not used.  This is a testable proposition.  Why not use
the wealth of data at our fingertips to augment a priori reasoning and
anecdotes.  I'm not at all arguing against the proposal; I'm just asking
for a thoughtful design process.

 

Raymond


P.S.  Josiah was not alone.  The comp.lang.python discussion had other
posts expressing distaste for raising exceptions instead of using return
codes.  While I don't feel the same way, I don't think the respondants
should be ignored.



"Those people who love sausage and respect the law should not watch
either one being made."



More information about the Python-Dev mailing list