Understanding "help" command description syntax - explanation needed

Ivan Evstegneev webmailgroups at gmail.com
Wed Nov 5 13:31:56 CET 2014


Chris,

You got my point exactly. ^_^ This is not about a "range" command itself, but those conventions.
Thanks.

Larry,

>> That's what I'm talking about (asking actually), where do you know it from?

>>I know it because I've been a programmer for 39 years.

I didn't intend to offence anyone here. Just asked a questions ^_^



-----Original Message-----
From: Python-list [mailto:python-list-bounces+webmailgroups=gmail.com at python.org] On Behalf Of Chris Angelico
Sent: Wednesday, November 5, 2014 14:16
Cc: python-list at python.org
Subject: Re: Understanding "help" command description syntax - explanation needed

On Wed, Nov 5, 2014 at 10:00 PM, Ivan Evstegneev <webmailgroups at gmail.com> wrote:
> range(start, stop[, step]) -> range object
>
> For instance, how do I need to understand that (start,stop[,step])  
> it’s just a three numbers?
>
> What do those brackets--> [,] mean?

The docs for range() in Python 3 do need improvement, as Mark said, although there's a bit more info than you see there. The exact text varies from one version to another, but underneath that first line should be something like:

"Return a virtual sequence of numbers from start to stop by step."

That should tell you a bit more, at least.

As to the brackets, they're a common convention meaning "optional".
This is much bigger than Python, so it's not actually explained anywhere. (I've no idea where someone would go to try to find info on these sorts of conventions. It's a little hard to do a Google search for symbols and their usages. But that's what mailing lists like this are for.) You can create a range object with two arguments (start and
stop) or three (start, stop, and step). When an argument is optional, it usually has a default, and in this case, the default step is 1 - every integer will be included.

Don't be afraid to ask questions. There are plenty of people here who know both Python and C (I'm one of them), and we're happy to help out.
And hey, you might find you can contribute a better piece of help text for something, and then we can make it better for every future wonderer :)

ChrisA
--
https://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list