[Tutor] help

Michael Janssen mi.janssen at gmail.com
Mon Oct 24 19:32:44 CEST 2005


On 10/24/05, Shi Mu <samrobertsmith at gmail.com> wrote:

> I got confused by the following information from the help for "FIND":
> find(s, *args)
>   find(s, sub [,start [,end]]) -> in

Hello Shi Mu,

this is the help for the function find in the string module, which is
slightly out of date. Better you use the string method find:

###
s = ""
help(s.find)

find(...)
    S.find(sub [,start [,end]]) -> int
 ###

so the "in" is simply a typo. find returns an "int" not an "in".
"*args" is the arbitrary number of arguments notation:
http://docs.python.org/tut/node6.html#SECTION006730000000000000000

which might be misleading and is replaced by "..." in the string
method's online help. The comma before start ist mandatory: *when* you
want to give a "start" argument, you leave out the []-brackets but you
need the comma:

s.find('something', 1)

The builtin documentation ist meant (there are such statements by
Guido van Rossum in the web) as a brief mnemonic for things that are
explained in more detail in the library documentation and the
tutorial.

regards
Michael


More information about the Tutor mailing list