Understanding "help" command description syntax - explanation needed

Ivan Evstegneev webmailgroups at gmail.com
Wed Nov 5 06:00:16 EST 2014


Hello everyone,

 

I'm a Python beginner and just getting familiar with it. (I need it for my
EE B.Sc. project) 

For the learning purposes I use IDLE and (Learning Python by written by Mark
Lutz).

Let's say that I have some earlier experience with C language, but still
Python is a different one )))

 

Anyway, the question I would like to ask is about understanding "help"
contents.

It may look to obvious and even a dumb question, but still I need your help.

 

Here is a brief background with example in order to introduce my problem in
more clear way:

 

Suppose I get some list created: 

 

>>>L=[i for i in range(1,15,2)]

As it can be seen, this is the odd numbers list: [1, 3, 5, 7, 9, 11, 13]

 

Supppose I need to check the occurrence of number 7, in this case I'll just
write:

>>>L.index(7)

The result is :3

 

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

 

As you've seen in my example I used range(1,15,2). But this knowledge I got
from googling a couple of sites.

I still can't understand the "help" command description. 

For instance, how do I need to understand that (start,stop[,step])  it's
just a three numbers? 

What do those brackets--> [,] mean?

 

The same about "str.replace" command, where I get this:

 

S.replace(old, new[, count]) - using this description I can't really
understand how to write the "replace" function parameters.

 

So I googled it up and found this example in order to get more clear
understanding of command use.

 

str = "this is string example....wow!!! this is really string"

print str.replace("is", "was")

print str.replace("is", "was", 3)

 

The result: 

thwas was string example....wow!!! thwas was really string

thwas was string example....wow!!! thwas is really string

 

But still how do I know that those "old, new" are the strings and [,count]
just a number? 

 I mean, it was more naturally(as a baginner) to me to write
str.replace(is,was[,3]) and that's all. 

 

 

Finally, as for my opinion, this is a lame way to learn  "what a command do"
by constantly googling it for examples. 

 

I need to get more familiar with "help", but the main problem, is that I
couldn't find any suitable explanations/tutorials about "help" syntax and
etc. (maybe didn't search well).

 

Any explanations/links will be greatly appreciated. I need some help for
"help" ^_^

 

Thanks in advance,

 

Ivan.   

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141105/06e1159a/attachment.html>


More information about the Python-list mailing list