Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80257 > unrolled thread

Understanding "help" command description syntax - explanation needed

Started by"Ivan Evstegneev" <webmailgroups@gmail.com>
First post2014-11-05 13:00 +0200
Last post2014-11-05 23:16 -0800
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Understanding "help" command description syntax - explanation needed "Ivan Evstegneev" <webmailgroups@gmail.com> - 2014-11-05 13:00 +0200
    Re: Understanding "help" command description syntax - explanation needed Larry Hudson <orgnut@yahoo.com> - 2014-11-05 23:16 -0800

#80257 — Understanding "help" command description syntax - explanation needed

From"Ivan Evstegneev" <webmailgroups@gmail.com>
Date2014-11-05 13:00 +0200
SubjectUnderstanding "help" command description syntax - explanation needed
Message-ID<mailman.15486.1415187679.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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.   

 

 

[toc] | [next] | [standalone]


#80317

FromLarry Hudson <orgnut@yahoo.com>
Date2014-11-05 23:16 -0800
Message-ID<NPmdneWu8vzSvcbJnZ2dnUU7-XednZ2d@giganews.com>
In reply to#80257
On 11/05/2014 03:00 AM, Ivan Evstegneev wrote:
> 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 )))

The Lutz book is an excellent and VERY thorough Python reference, but it is not very good as a 
beginner's tutorial.  The standard Python.org tutorial can be a better starting point.  Of 
course, there are a lot of other good sources as well -- both on-line and dead-tree versions. 
Try some googling.  Also the Python Wiki has a lot of valuable links:

https://wiki.python.org/moin/

      -=- Larry -=-

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web