By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,537 Members | 1,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,537 IT Pros & Developers. It's quick & easy.

How to search the Python manuals

P: n/a
A number of questions asked here could easily be answered by a quick
search of the Python Manuals. A prime example is about the behavior of
default parameter values.

A recent questioner ended the thread with "The problem with this
particular question is that I found it hard to find a query that would
give meaningful answers."

The following is intended to show how he might have found an answer to
this question and, by extension, how others might answer other questions
using the 2.4 to 3.0 manuals. (I do not have 2.6 but presume its manual
set works the same as the 3.0 set.)

--------------------------------------
For WinXP (I have no idea of how the manuals works elsewhere):

Open the Python Manuals shortcut.

On the left, click [+] for Language Reference
(3.0: The Python language reference).

Scan the chapter list to find [+] Compound Statements
[statements with a header line and indented suite].

Click [+], find Function definitions and click on that.
(In 3.0, one can instead directly click Compound Statements since entire
chapters rather than just sections are loaded into the right pane.)

Click on the right frame/pane to shift 'focus'.

Enter control-F and wait (at least a second, be patient) to open a Find box.

Enter 'default' (but not too much, such as 'default argument') and click
Next. This brings you to the discussion of default parameter values.

Either read or continue clicking Next until you come to the boldfaced
line that begins the next paragraph: "Default parameter values are
evaluated when the function definition is executed." This is followed by
an explanation of why one would usually want 'param = None' + body code
rather than 'param = []'.

-----------------------------------------

It helps if one reads all of the language reference and the first
chapters of the library reference on built-ins at least once. They are
constantly being improved as mistakes and ambiguities are found and
reported.

The global module index (top of the left pane) is useful when you know
(or maybe just suspect) the name of a module.

Terry Jan Reedy


Aug 22 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
JBW
On Fri, 22 Aug 2008 16:17:16 -0400, Terry Reedy instructs a procedure for
locating the behavior of default function arguments:
-------------------------------------- For WinXP (I have no idea of how
the manuals works elsewhere):
Windows is against my religion, so I may be completely off base here :)
<... snip prolonged clicky-clicky tap dance instructions. ...>
The way I read it is that one has little trouble answering a question by
reading the documentation if one knows *exactly* where to look.

It is much easier to find where to look if the documentation corpus has a
proper index. Since indexing is hard work that's effectively impossible
to automate, I suspect Python's documentation is no better than many
other open-source software projects.

I learned what little Python I know from Martelli's book, which is quite
well indexed. Those last 80 pages are very well worn.

Jim Wilson
Gainesville, FL

Aug 23 '08 #2

P: n/a
On Sat, 23 Aug 2008 21:00:57 +0000, JBW wrote:
It is much easier to find where to look if the documentation corpus has
a proper index. Since indexing is hard work that's effectively
impossible to automate, I suspect Python's documentation is no better
than many other open-source software projects.
I think the indexes of the documentation are quite good:

http://docs.python.org/lib/genindex.html
http://docs.python.org/ref/genindex.html

First occurance of "default" in the reference index leads to the
information about default parameters and that they are executed once,
when the ``def`` statement is executed:

http://docs.python.org/ref/function.html#l2h-634

Ciao,
Marc 'BlackJack' Rintsch
Aug 23 '08 #3

P: n/a


JBW wrote:
On Fri, 22 Aug 2008 16:17:16 -0400, Terry Reedy instructs a procedure for
locating the behavior of default function arguments:
>-------------------------------------- For WinXP (I have no idea of how
the manuals works elsewhere):

Windows is against my religion, so I may be completely off base here :)
><... snip prolonged clicky-clicky tap dance instructions. ...>

The way I read it is that one has little trouble answering a question by
reading the documentation if one knows *exactly* where to look.
Then you read wrong. What my tap-dance instructions said were to find
the right *CHAPTER* (for upcoming 2.6/3.0) and use ^Find to find the
exact place. If you don't know that def statements are compound
statements and not lexical analysis, data, expressions, or simple
statements, they you would profit from reading a bit more at the top of
each chapter.

tjr

Aug 24 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.