On 05/11/2014 11:55, Jean-Michel Pichavant wrote:
---- Original Message -----
From: "Ivan Evstegneev" <webmailgro...@gmail.com>
To: python-list@python.org
Sent: Wednesday, 5 November, 2014 12:00:16 PM
Subject: Understanding "help" command description syntax - explanation needed
So here is the question itself:
If I use the help command to check the “range” command I get this
info:
range(stop) -> range object
range(start, stop[, step]) -> range object
With python 2.7, when I type help(range), I get
"""
Help on built-in function range in module __builtin__:
range(...)
range([start,] stop[, step]) -> list of integers
Return a list containing an arithmetic progression of integers.
range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.
When step is given, it specifies the increment (or decrement).
For example, range(4) returns [0, 1, 2, 3]. The end point is omitted!
These are exactly the valid indices for a list of 4 elements.
"""
range([start,] stop[, step]) tells you how to call the range function, there's
a start, stop and step argument.
The purpose of these arguments are given by the longer description.
brackets [] means that the argument is optional.
Though there's nothing wrong with googling the function for help, I'm doing it
all the time.
Actually, the python documentation is a better place to get help on a
particular function, just make sure you hit the correct version, for either
python 2 or 3:
https://docs.python.org/2/library/functions.html#range
I'm using python's help function only when working offline.
JM
There is an issue on the bug tracker about the difference between help
for range between Python 2 and 3, see http://bugs.python.org/issue22785
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mail.python.org/mailman/listinfo/python-list