[docs] Python tutorial - example on "range" function (chapter Built-in Functions)
Georg Brandl
georg at python.org
Tue Feb 2 12:57:31 EST 2016
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 02/02/2016 06:32 PM, Cristian Dragan (cdragan) wrote:
> Hi,
>
>
>
> According to the definition of the range function (within the Python
> tutorial 2.7.11) I assume that
>
>
>
> />>> range(1, 0)/
>
>
>
> Should have 1 element: [1], while the tutorial specify: [].
>
>
>
> Please let me know if I misunderstood the definition of the “range”
> function.
Hi Cristian,
as far as I can see, the tutorial only contains an informal description of
range(), which covers the basic use. Corner cases like this should be
covered by the library docs, which you get to when you click the range()
link.
Unfortunately, that text doesn't fully specify this case either, although
the example code shows both range(0) and range(1, 0) being empty.
So I think that the range() docs should be amended. In Python 3, the text
is much clearer: https://docs.python.org/3/library/stdtypes.html#range
If you'd like the tutorial text to change as well, can you tell us more
specifically where?
cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iEYEARECAAYFAlaw7gsACgkQN9GcIYhpnLAHIgCfUZdKHjsLHhGpEv0HvBeyUnPO
loMAoK3JDjJQVxejGUfOBzFjF/PAtV/h
=fW3L
-----END PGP SIGNATURE-----
More information about the docs
mailing list