[Python-ideas] Pass a function as the argument "step" of range()

Andrew Barnert abarnert at yahoo.com
Fri Jul 3 12:29:35 CEST 2015


On Jul 2, 2015, at 08:53, Pierre Quentel <pierre.quentel at gmail.com> wrote:
> 
> It's true, but testing that an integer is a range is very rare : the pattern "if X in range(Y)" is only found once in all the Python 3.4 standard library

Given that most of the stdlib predates Python 3.2, and modules are rarely rewritten to take advantage of new features just for the hell of it, this isn't very surprising, or very meaningful.

Similarly, you'll find that most of the stdlib doesn't use yield from expressions, and many things that could be written in terms of singledispatch instead use type switching, and so on. This doesn't mean yield from or singledispatch are useless or rarely used.


More information about the Python-ideas mailing list