2015-07-03 12:29 GMT+02:00 Andrew Barnert
On Jul 2, 2015, at 08:53, Pierre Quentel
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) 1
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.