1 .TH PYTHON "1" "$Date$"
3 python \- an interpreted, interactive, object-oriented programming language
65 Python is an interpreted, interactive, object-oriented programming
66 language that combines remarkable power with very clear syntax.
67 For an introduction to programming in Python you are referred to the
69 The Python Library Reference documents built-in and standard types,
70 constants, functions and modules.
71 Finally, the Python Reference Manual describes the syntax and
72 semantics of the core language in (perhaps too) much detail.
73 (These documents may be located via the
74 .B "INTERNET RESOURCES"
75 below; they may be installed on your system as well.)
77 Python's basic power can be extended with your own modules written in
79 On most systems such modules may be dynamically loaded.
80 Python is also adaptable as an extension language for existing
82 See the internal documentation for hints.
84 Documentation for installed Python modules and packages can be
88 .SH COMMAND LINE OPTIONS
91 Specify the command to execute (see next section).
92 This terminates the option list (following options are passed as
93 arguments to the command).
96 Turn on parser debugging output (for wizards only, depending on
100 Ignore environment variables like PYTHONPATH and PYTHONHOME that modify
101 the behavior of the interpreter.
104 Prints the usage for the interpreter executable and exits.
107 When a script is passed as first argument or the \fB\-c\fP option is
108 used, enter interactive mode after executing the script or the
109 command. It does not read the $PYTHONSTARTUP file. This can be
110 useful to inspect global variables or a stack trace when a script
114 Turn on basic optimizations. This changes the filename extension for
115 compiled (bytecode) files from
117 to \fI.pyo\fP. Given twice, causes docstrings to be discarded.
120 Division control; see PEP 238. The argument must be one of "old" (the
121 default, int/int and long/long return an int or long), "new" (new
122 division semantics, i.e. int/int and long/long returns a float),
123 "warn" (old division semantics with a warning for int/int and
124 long/long), or "warnall" (old division semantics with a warning for
125 all use of the division operator). For a use of "warnall", see the
126 Tools/scripts/fixdiv.py script.
129 Disable the import of the module
131 and the site-dependent manipulations of
136 Issue a warning when a source file mixes tabs and spaces for
137 indentation in a way that makes it depend on the worth of a tab
138 expressed in spaces. Issue an error when the option is given twice.
141 Force stdin, stdout and stderr to be totally unbuffered.
144 Print a message each time a module is initialized, showing the place
145 (filename or built-in module) from which it is loaded. When given
146 twice, print a message for each file that is checked for when
147 searching for a module. Also provides information on module cleanup
151 Prints the Python version number of the executable and exits.
154 Warning control. Python sometimes prints warning message to
156 A typical warning message has the following form:
157 .IB file ":" line ": " category ": " message.
158 By default, each warning is printed once for each source line where it
159 occurs. This option controls how often warnings are printed.
162 options may be given; when a warning matches more than one
163 option, the action for the last matching option is performed.
166 options are ignored (a warning message is printed about invalid
167 options when the first warning is issued). Warnings can also be
168 controlled from within a Python program using the
174 is one of the following
176 strings (or a unique abbreviation):
178 to ignore all warnings;
180 to explicitly request the default behavior (printing each warning once
183 to print a warning each time it occurs (this may generate many
184 messages if a warning is triggered repeatedly for the same source
185 line, such as inside a loop);
187 to print each warning only only the first time it occurs in each
190 to print each warning only the first time it occurs in the program; or
192 to raise an exception instead of printing a warning message.
197 .IB action : message : category : module : line.
200 is as explained above but only applies to messages that match the
201 remaining fields. Empty fields match all values; trailing empty
202 fields may be omitted. The
204 field matches the start of the warning message printed; this match is
205 case-insensitive. The
207 field matches the warning category. This must be a class name; the
208 match test whether the actual warning category of the message is a
209 subclass of the specified warning category. The full class name must
212 field matches the (fully-qualified) module name; this match is
215 field matches the line number, where zero matches all line numbers and
216 is thus equivalent to an omitted line number.
219 Skip the first line of the source. This is intended for a DOS
220 specific hack only. Warning: the line numbers in error messages will
222 .SH INTERPRETER INTERFACE
223 The interpreter interface resembles that of the UNIX shell: when
224 called with standard input connected to a tty device, it prompts for
225 commands and executes them until an EOF is read; when called with a
226 file name argument or with a file as standard input, it reads and
233 it executes the Python statement(s) given as
237 may contain multiple statements separated by newlines.
238 Leading whitespace is significant in Python statements!
239 In non-interactive mode, the entire input is parsed befored it is
242 If available, the script name and additional arguments thereafter are
243 passed to the script in the Python variable
245 which is a list of strings (you must first
247 to be able to access it).
248 If no script name is given,
250 is an empty string; if
256 Note that options interpreted by the Python interpreter itself
260 In interactive mode, the primary prompt is `>>>'; the second prompt
261 (which appears when a command is not complete) is `...'.
262 The prompts can be changed by assignment to
266 The interpreter quits when it reads an EOF at a prompt.
267 When an unhandled exception occurs, a stack trace is printed and
268 control returns to the primary prompt; in non-interactive mode, the
269 interpreter exits after printing the stack trace.
270 The interrupt signal raises the
271 .I Keyboard\%Interrupt
272 exception; other UNIX signals are not caught (except that SIGPIPE is
273 sometimes ignored, in favor of the
275 exception). Error messages are written to stderr.
276 .SH FILES AND DIRECTORIES
277 These are subject to difference depending on local installation
278 conventions; ${prefix} and ${exec_prefix} are installation-dependent
279 and should be interpreted as for GNU software; they may be the same.
280 The default for both is \fI/usr/local\fP.
281 .IP \fI${exec_prefix}/bin/python\fP
282 Recommended location of the interpreter.
284 .I ${prefix}/lib/python<version>
286 .I ${exec_prefix}/lib/python<version>
288 Recommended locations of the directories containing the standard
292 .I ${prefix}/include/python<version>
294 .I ${exec_prefix}/include/python<version>
296 Recommended locations of the directories containing the include files
297 needed for developing Python extensions and embedding the
300 .IP \fI~/.pythonrc.py\fP
301 User-specific initialization file loaded by the \fIuser\fP module;
302 not used by default or by most applications.
303 .SH ENVIRONMENT VARIABLES
305 Change the location of the standard Python libraries. By default, the
306 libraries are searched in ${prefix}/lib/python<version> and
307 ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix}
308 are installation-dependent directories, both defaulting to
309 \fI/usr/local\fP. When $PYTHONHOME is set to a single directory, its value
310 replaces both ${prefix} and ${exec_prefix}. To specify different values
311 for these, set $PYTHONHOME to ${prefix}:${exec_prefix}.
313 Augments the default search path for module files.
314 The format is the same as the shell's $PATH: one or more directory
315 pathnames separated by colons.
316 Non-existant directories are silently ignored.
317 The default search path is installation dependent, but generally
318 begins with ${prefix}/lib/python<version> (see PYTHONHOME above).
319 The default search path is always appended to $PYTHONPATH.
320 If a script argument is given, the directory containing the script is
321 inserted in the path in front of $PYTHONPATH.
322 The search path can be manipulated from within a Python program as the
326 If this is the name of a readable file, the Python commands in that
327 file are executed before the first prompt is displayed in interactive
329 The file is executed in the same name space where interactive commands
330 are executed so that objects defined or imported in it can be used
331 without qualification in the interactive session.
332 You can also change the prompts
338 Set this to a non-empty string to cause the \fItime\fP module to
339 require dates specified as strings to include 4-digit years, otherwise
340 2-digit years are converted based on rules described in the \fItime\fP
341 module documentation.
343 If this is set to a non-empty string it is equivalent to specifying
344 the \fB\-O\fP option. If set to an integer, it is equivalent to
345 specifying \fB\-O\fP multiple times.
347 If this is set to a non-empty string it is equivalent to specifying
348 the \fB\-d\fP option. If set to an integer, it is equivalent to
349 specifying \fB\-d\fP multiple times.
351 If this is set to a non-empty string it is equivalent to specifying
352 the \fB\-i\fP option.
354 If this is set to a non-empty string it is equivalent to specifying
355 the \fB\-u\fP option.
357 If this is set to a non-empty string it is equivalent to specifying
358 the \fB\-v\fP option. If set to an integer, it is equivalent to
359 specifying \fB\-v\fP multiple times.
364 E-mail: guido@python.org
367 And a cast of thousands.
368 .SH INTERNET RESOURCES
369 Main website: http://www.python.org/
371 Documentation: http://www.python.org/doc/
373 Community website: http://starship.python.net/
375 Developer resources: http://sourceforge.net/project/python/
377 FTP: ftp://ftp.python.org/pub/python/
379 Module repository: http://www.vex.net/parnassus/
381 Newsgroups: comp.lang.python, comp.lang.python.announce
383 Python is distributed under an Open Source license. See the file
384 "LICENSE" in the Python source distribution for information on terms &
385 conditions for accessing and otherwise using Python and for a
386 DISCLAIMER OF ALL WARRANTIES.