1 .TH PYTHON "1" "5 September, 2000"
3 python \- an interpreted, interactive, object-oriented programming language
53 Python is an interpreted, interactive, object-oriented programming
54 language that combines remarkable power with very clear syntax.
55 For an introduction to programming in Python you are referred to the
57 The Python Library Reference documents built-in and standard types,
58 constants, functions and modules.
59 Finally, the Python Reference Manual describes the syntax and
60 semantics of the core language in (perhaps too) much detail.
61 (These documents may be located via the
62 .B "INTERNET RESOURCES"
63 below; they may be installed on your system as well.)
65 Python's basic power can be extended with your own modules written in
67 On most systems such modules may be dynamically loaded.
68 Python is also adaptable as an extension language for existing
70 See the internal documentation for hints.
72 Documentation for installed Python modules and packages can be
76 .SH COMMAND LINE OPTIONS
79 Turn on parser debugging output (for wizards only, depending on
83 When a script is passed as first argument or the \fB\-c\fP option is
84 used, enter interactive mode after executing the script or the
85 command. It does not read the $PYTHONSTARTUP file. This can be
86 useful to inspect global variables or a stack trace when a script
90 Turn on basic optimizations. This changes the filename extension for
91 compiled (bytecode) files from
93 to \fI.pyo\fP. Given twice, causes docstrings to be discarded.
96 Disable the import of the module
98 and the site-dependent manipulations of
103 Issue a warning when a source file mixes tabs and spaces for
104 indentation in a way that makes it depend on the worth of a tab
105 expressed in spaces. Issue an error when the option is given twice.
108 Force stdin, stdout and stderr to be totally unbuffered.
111 Print a message each time a module is initialized, showing the place
112 (filename or built-in module) from which it is loaded. When given
113 twice, print a message for each file that is checked for when
114 searching for a module. Also provides information on module cleanup
118 Skip the first line of the source. This is intended for a DOS
119 specific hack only. Warning: the line numbers in error messages will
123 Prints the usage for the interpreter executable and exits.
126 Prints the Python version number of the executable and exits.
129 Warning control. Python sometimes prints warning message to
131 A typical warning message has the following form:
132 .IB file ":" line ": " category ": " message.
133 By default, each warning is printed once for each source line where it
134 occurs. This option controls how often warnings are printed.
137 options may be given; when a warning matches more than one
138 option, the action for the last matching option is performed.
141 options are ignored (a warning message is printed about invalid
142 options when the first warning is issued). Warnings can also be
143 controlled from within a Python program using the
149 is one of the following
151 strings (or a unique abbreviation):
153 to ignore all warnings;
155 to explicitly request the default behavior (printing each warning once
158 to print a warning each time it occurs (this may generate many
159 messages if a warning is triggered repeatedly for the same source
160 line, e.g. inside a loop);
162 to print each warning only only the first time it occurs in each
165 to print each warning only the first time it occurs in the program; or
167 to raise an exception instead of printing a warning message.
172 .IB action : message : category : module : line.
175 is as explained above but only applies to messages that match the
176 remaining fields. Empty fields match all values; trailing empty
177 fields may be omitted. The
179 field matches the start of the warning message printed; this match is
180 case-insensitive. The
182 field matches the warning category. This must be a class name; the
183 match test whether the actual warning category of the message is a
184 subclass of the specified warning category. The full class name must
187 field matches the (fully-qualified) module name; this match is
190 field matches the line number, where zero matches all line numbers and
191 is thus equivalent to an omitted line number.
194 Specify the command to execute (see next section).
195 This terminates the option list (following options are passed as
196 arguments to the command).
197 .SH INTERPRETER INTERFACE
198 The interpreter interface resembles that of the UNIX shell: when
199 called with standard input connected to a tty device, it prompts for
200 commands and executes them until an EOF is read; when called with a
201 file name argument or with a file as standard input, it reads and
208 it executes the Python statement(s) given as
212 may contain multiple statements separated by newlines.
213 Leading whitespace is significant in Python statements!
214 In non-interactive mode, the entire input is parsed befored it is
217 If available, the script name and additional arguments thereafter are
218 passed to the script in the Python variable
220 which is a list of strings (you must first
222 to be able to access it).
223 If no script name is given,
225 is an empty string; if
231 Note that options interpreted by the Python interpreter itself
235 In interactive mode, the primary prompt is `>>>'; the second prompt
236 (which appears when a command is not complete) is `...'.
237 The prompts can be changed by assignment to
241 The interpreter quits when it reads an EOF at a prompt.
242 When an unhandled exception occurs, a stack trace is printed and
243 control returns to the primary prompt; in non-interactive mode, the
244 interpreter exits after printing the stack trace.
245 The interrupt signal raises the
246 .I Keyboard\%Interrupt
247 exception; other UNIX signals are not caught (except that SIGPIPE is
248 sometimes ignored, in favor of the
250 exception). Error messages are written to stderr.
251 .SH FILES AND DIRECTORIES
252 These are subject to difference depending on local installation
253 conventions; ${prefix} and ${exec_prefix} are installation-dependent
254 and should be interpreted as for GNU software; they may be the same.
255 The default for both is \fI/usr/local\fP.
256 .IP \fI${exec_prefix}/bin/python\fP
257 Recommended location of the interpreter.
259 .I ${prefix}/lib/python<version>
261 .I ${exec_prefix}/lib/python<version>
263 Recommended locations of the directories containing the standard
267 .I ${prefix}/include/python<version>
269 .I ${exec_prefix}/include/python<version>
271 Recommended locations of the directories containing the include files
272 needed for developing Python extensions and embedding the
275 .IP \fI~/.pythonrc.py\fP
276 User-specific initialization file loaded by the \fIuser\fP module;
277 not used by default or by most applications.
278 .SH ENVIRONMENT VARIABLES
280 Change the location of the standard Python libraries. By default, the
281 libraries are searched in ${prefix}/lib/python<version> and
282 ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix}
283 are installation-dependent directories, both defaulting to
284 \fI/usr/local\fP. When $PYTHONHOME is set to a single directory, its value
285 replaces both ${prefix} and ${exec_prefix}. To specify different values
286 for these, set $PYTHONHOME to ${prefix}:${exec_prefix}.
288 Augments the default search path for module files.
289 The format is the same as the shell's $PATH: one or more directory
290 pathnames separated by colons.
291 Non-existant directories are silently ignored.
292 The default search path is installation dependent, but generally
293 begins with ${prefix}/lib/python<version> (see PYTHONHOME above).
294 The default search path is always appended to $PYTHONPATH.
295 If a script argument is given, the directory containing the script is
296 inserted in the path in front of $PYTHONPATH.
297 The search path can be manipulated from within a Python program as the
301 If this is the name of a readable file, the Python commands in that
302 file are executed before the first prompt is displayed in interactive
304 The file is executed in the same name space where interactive commands
305 are executed so that objects defined or imported in it can be used
306 without qualification in the interactive session.
307 You can also change the prompts
313 If this is set to a non-empty string it is equivalent to specifying
314 the \fB\-d\fP option.
316 If this is set to a non-empty string it is equivalent to specifying
317 the \fB\-i\fP option.
319 If this is set to a non-empty string it is equivalent to specifying
320 the \fB\-u\fP option.
322 If this is set to a non-empty string it is equivalent to specifying
323 the \fB\-v\fP option.
328 E-mail: guido@python.org
331 And a cast of thousands.
332 .SH INTERNET RESOURCES
333 Main website: http://www.python.org
335 Community website: http://starship.python.net
339 http://sourceforge.net/project/?group_id=5470
341 FTP: ftp://ftp.python.org/pub/python
343 Module repository: http://www.vex.net/parnassus/
345 Newsgroups: comp.lang.python, comp.lang.python.announce
347 Python is distributed under an Open Source license. See the file
348 "LICENSE" in the Python source distribution for information on terms &
349 conditions for accessing and otherwise using Python and for a
350 DISCLAIMER OF ALL WARRANTIES.