mirror of https://github.com/python/cpython
Document the -W option as best as I can.
Get rid of BeOpen references.
This commit is contained in:
parent
d1db30b7b5
commit
1378c32dd8
|
@ -33,6 +33,10 @@ python \- an interpreted, interactive, object-oriented programming language
|
|||
[
|
||||
.B \-V
|
||||
]
|
||||
[
|
||||
.B \-W
|
||||
.I argument
|
||||
]
|
||||
.br
|
||||
[
|
||||
.B \-c
|
||||
|
@ -116,6 +120,71 @@ Prints the usage for the interpreter executable and exits.
|
|||
.B \-V
|
||||
Prints the Python version number of the executable and exits.
|
||||
.TP
|
||||
.BI "\-W " argument
|
||||
Warning control. Python sometimes prints warning message to
|
||||
.IR sys.stderr .
|
||||
A typical warning message has the following form:
|
||||
.IB file ":" line ": " category ": " message.
|
||||
By default, each warning is printed once for each source line where it
|
||||
occurs. This option controls how often warnings are printed.
|
||||
Multiple
|
||||
.B \-W
|
||||
options may be given; when a warning matches more than one
|
||||
option, the action for the last matching option is performed.
|
||||
Invalid
|
||||
.B \-W
|
||||
options are ignored (a warning message is printed about invalid
|
||||
options when the first warning is issued). Warnings can also be
|
||||
controlled from within a Python program using the
|
||||
.I warnings
|
||||
module.
|
||||
|
||||
The simplest form of
|
||||
.I argument
|
||||
is one of the following
|
||||
.I action
|
||||
strings (or a unique abbreviation):
|
||||
.B ignore
|
||||
to ignore all warnings;
|
||||
.B default
|
||||
to explicitly request the default behavior (printing each warning once
|
||||
per source line);
|
||||
.B all
|
||||
to print a warning each time it occurs (this may generate many
|
||||
messages if a warning is triggered repeatedly for the same source
|
||||
line, e.g. inside a loop);
|
||||
.B module
|
||||
to print each warning only only the first time it occurs in each
|
||||
module;
|
||||
.B once
|
||||
to print each warning only the first time it occurs in the program; or
|
||||
.B error
|
||||
to raise an exception instead of printing a warning message.
|
||||
|
||||
The full form of
|
||||
.I argument
|
||||
is
|
||||
.IB action : message : category : module : line.
|
||||
Here,
|
||||
.I action
|
||||
is as explained above but only applies to messages that match the
|
||||
remaining fields. Empty fields match all values; trailing empty
|
||||
fields may be omitted. The
|
||||
.I message
|
||||
field matches the start of the warning message printed; this match is
|
||||
case-insensitive. The
|
||||
.I category
|
||||
field matches the warning category. This must be a class name; the
|
||||
match test whether the actual warning category of the message is a
|
||||
subclass of the specified warning category. The full class name must
|
||||
be given. The
|
||||
.I module
|
||||
field matches the (fully-qualified) module name; this match is
|
||||
case-sensitive. The
|
||||
.I line
|
||||
field matches the line number, where zero matches all line numbers and
|
||||
is thus equivalent to an omitted line number.
|
||||
.TP
|
||||
.BI "\-c " command
|
||||
Specify the command to execute (see next section).
|
||||
This terminates the option list (following options are passed as
|
||||
|
@ -250,20 +319,14 @@ the \fB\-v\fP option.
|
|||
.SH AUTHOR
|
||||
.nf
|
||||
Guido van Rossum
|
||||
BeOpen.com
|
||||
160 Saratoga Avenue
|
||||
Santa Clara, CA 95051
|
||||
USA
|
||||
.PP
|
||||
E-mail: guido@beopen.com, guido@python.org
|
||||
E-mail: guido@python.org
|
||||
.fi
|
||||
.PP
|
||||
And a cast of thousands.
|
||||
.SH INTERNET RESOURCES
|
||||
Main website: http://www.python.org
|
||||
.br
|
||||
BeOpen development team: http://pythonlabs.com
|
||||
.br
|
||||
Community website: http://starship.python.net
|
||||
.br
|
||||
Developer resources:
|
||||
|
|
Loading…
Reference in New Issue