Strange range

Chris Angelico rosuav at gmail.com
Sun Apr 3 03:08:21 EDT 2016


On Sun, Apr 3, 2016 at 4:43 PM, Stephen Hansen <me+python at ixokai.io> wrote:
> The stdlib exists as a bastion of stability above all else. Its
> standards aren't a reason to make a change (or, not to make a change,
> either). That doesn't mean its not useful to look at the standard
> library, but you should not enshrine it as the example of good or
> idiomatic code to measure decisions against. Most code exists outside
> the stdlib.

Expanding on this: There have been times when the stdlib has been
cited in proposals, such as the introduction of a new keyword. Out of
five plausible words, two have significant use in the stdlib, another
has a couple of uses, and two more have no references at all. Specific
example from PEP 359 [1]; the same line of analysis has also been used
elsewhere. Also, a proposed new syntax can attempt to justify its
benefit by taking examples from the stdlib, not because they will
necessarily be changed, but simply because it's a good-sized codebase
that all Python devs and tinkerers will have easy access to. PEP 463
[2] demonstrates this. Similarly, but in reverse: The stdlib can
provide examples showing how a proposal will _break_ existing code,
and how it should be fixed; PEP 479 [3] has a few examples, some from
the stdlib, some hypothetical. In each case, the stdlib is being
treated as simply "a body of Python code", and one which has a measure
of neutrality (we're not favouring web app developers by looking at
the Django source code, or numeric computational work by looking at
Pandas, or anything like that), and if anything, it's indicative of
older codebases rather than newer ones, which is usually good for
proposals that need to be conservative.

So in the case of range() usage, I would say that stdlib usage showing
"x in range(...)" would be highly significant, but *absence* of such
usage is not.

ChrisA

[1] https://www.python.org/dev/peps/pep-0359/#keyword
[2] https://www.python.org/dev/peps/pep-0463/#example-usage
[3] https://www.python.org/dev/peps/pep-0479/#examples-of-breakage



More information about the Python-list mailing list