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. On systems
142 where it matters, also put stdin, stdout and stderr in binary mode.
143 Note that there is internal buffering in xreadlines(), readlines() and
144 file-object iterators ("for line in sys.stdin") which is not
145 influenced by this option. To work around this, you will want to use
146 "sys.stdin.readline()" inside a "while 1:" loop.
149 Print a message each time a module is initialized, showing the place
150 (filename or built-in module) from which it is loaded. When given
151 twice, print a message for each file that is checked for when
152 searching for a module. Also provides information on module cleanup
156 Prints the Python version number of the executable and exits.
159 Warning control. Python sometimes prints warning message to
161 A typical warning message has the following form:
162 .IB file ":" line ": " category ": " message.
163 By default, each warning is printed once for each source line where it
164 occurs. This option controls how often warnings are printed.
167 options may be given; when a warning matches more than one
168 option, the action for the last matching option is performed.
171 options are ignored (a warning message is printed about invalid
172 options when the first warning is issued). Warnings can also be
173 controlled from within a Python program using the
179 is one of the following
181 strings (or a unique abbreviation):
183 to ignore all warnings;
185 to explicitly request the default behavior (printing each warning once
188 to print a warning each time it occurs (this may generate many
189 messages if a warning is triggered repeatedly for the same source
190 line, such as inside a loop);
192 to print each warning only only the first time it occurs in each
195 to print each warning only the first time it occurs in the program; or
197 to raise an exception instead of printing a warning message.
202 .IB action : message : category : module : line.
205 is as explained above but only applies to messages that match the
206 remaining fields. Empty fields match all values; trailing empty
207 fields may be omitted. The
209 field matches the start of the warning message printed; this match is
210 case-insensitive. The
212 field matches the warning category. This must be a class name; the
213 match test whether the actual warning category of the message is a
214 subclass of the specified warning category. The full class name must
217 field matches the (fully-qualified) module name; this match is
220 field matches the line number, where zero matches all line numbers and
221 is thus equivalent to an omitted line number.
224 Skip the first line of the source. This is intended for a DOS
225 specific hack only. Warning: the line numbers in error messages will
227 .SH INTERPRETER INTERFACE
228 The interpreter interface resembles that of the UNIX shell: when
229 called with standard input connected to a tty device, it prompts for
230 commands and executes them until an EOF is read; when called with a
231 file name argument or with a file as standard input, it reads and
238 it executes the Python statement(s) given as
242 may contain multiple statements separated by newlines.
243 Leading whitespace is significant in Python statements!
244 In non-interactive mode, the entire input is parsed befored it is
247 If available, the script name and additional arguments thereafter are
248 passed to the script in the Python variable
250 which is a list of strings (you must first
252 to be able to access it).
253 If no script name is given,
255 is an empty string; if
261 Note that options interpreted by the Python interpreter itself
265 In interactive mode, the primary prompt is `>>>'; the second prompt
266 (which appears when a command is not complete) is `...'.
267 The prompts can be changed by assignment to
271 The interpreter quits when it reads an EOF at a prompt.
272 When an unhandled exception occurs, a stack trace is printed and
273 control returns to the primary prompt; in non-interactive mode, the
274 interpreter exits after printing the stack trace.
275 The interrupt signal raises the
276 .I Keyboard\%Interrupt
277 exception; other UNIX signals are not caught (except that SIGPIPE is
278 sometimes ignored, in favor of the
280 exception). Error messages are written to stderr.
281 .SH FILES AND DIRECTORIES
282 These are subject to difference depending on local installation
283 conventions; ${prefix} and ${exec_prefix} are installation-dependent
284 and should be interpreted as for GNU software; they may be the same.
285 The default for both is \fI/usr/local\fP.
286 .IP \fI${exec_prefix}/bin/python\fP
287 Recommended location of the interpreter.
289 .I ${prefix}/lib/python<version>
291 .I ${exec_prefix}/lib/python<version>
293 Recommended locations of the directories containing the standard
297 .I ${prefix}/include/python<version>
299 .I ${exec_prefix}/include/python<version>
301 Recommended locations of the directories containing the include files
302 needed for developing Python extensions and embedding the
305 .IP \fI~/.pythonrc.py\fP
306 User-specific initialization file loaded by the \fIuser\fP module;
307 not used by default or by most applications.
308 .SH ENVIRONMENT VARIABLES
310 Change the location of the standard Python libraries. By default, the
311 libraries are searched in ${prefix}/lib/python<version> and
312 ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix}
313 are installation-dependent directories, both defaulting to
314 \fI/usr/local\fP. When $PYTHONHOME is set to a single directory, its value
315 replaces both ${prefix} and ${exec_prefix}. To specify different values
316 for these, set $PYTHONHOME to ${prefix}:${exec_prefix}.
318 Augments the default search path for module files.
319 The format is the same as the shell's $PATH: one or more directory
320 pathnames separated by colons.
321 Non-existant directories are silently ignored.
322 The default search path is installation dependent, but generally
323 begins with ${prefix}/lib/python<version> (see PYTHONHOME above).
324 The default search path is always appended to $PYTHONPATH.
325 If a script argument is given, the directory containing the script is
326 inserted in the path in front of $PYTHONPATH.
327 The search path can be manipulated from within a Python program as the
331 If this is the name of a readable file, the Python commands in that
332 file are executed before the first prompt is displayed in interactive
334 The file is executed in the same name space where interactive commands
335 are executed so that objects defined or imported in it can be used
336 without qualification in the interactive session.
337 You can also change the prompts
343 Set this to a non-empty string to cause the \fItime\fP module to
344 require dates specified as strings to include 4-digit years, otherwise
345 2-digit years are converted based on rules described in the \fItime\fP
346 module documentation.
348 If this is set to a non-empty string it is equivalent to specifying
349 the \fB\-O\fP option. If set to an integer, it is equivalent to
350 specifying \fB\-O\fP multiple times.
352 If this is set to a non-empty string it is equivalent to specifying
353 the \fB\-d\fP option. If set to an integer, it is equivalent to
354 specifying \fB\-d\fP multiple times.
356 If this is set to a non-empty string it is equivalent to specifying
357 the \fB\-i\fP option.
359 If this is set to a non-empty string it is equivalent to specifying
360 the \fB\-u\fP option.
362 If this is set to a non-empty string it is equivalent to specifying
363 the \fB\-v\fP option. If set to an integer, it is equivalent to
364 specifying \fB\-v\fP multiple times.
369 E-mail: guido@python.org
372 And a cast of thousands.
373 .SH INTERNET RESOURCES
374 Main website: http://www.python.org/
376 Documentation: http://www.python.org/doc/
378 Community website: http://starship.python.net/
380 Developer resources: http://sourceforge.net/project/python/
382 FTP: ftp://ftp.python.org/pub/python/
384 Module repository: http://www.vex.net/parnassus/
386 Newsgroups: comp.lang.python, comp.lang.python.announce
388 Python is distributed under an Open Source license. See the file
389 "LICENSE" in the Python source distribution for information on terms &
390 conditions for accessing and otherwise using Python and for a
391 DISCLAIMER OF ALL WARRANTIES.