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

Pierre Quentel pierre.quentel at gmail.com
Sun Jul 5 18:15:09 CEST 2015

2015-07-03 12:29 GMT+02:00 Andrew Barnert <abarnert at yahoo.com>:

> 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.

Then most of the stdlib also predates Python 1.5.2 (the version I started
with) :

Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> 4 in range(10)

> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150705/8ae42918/attachment.html>

More information about the Python-ideas mailing list