Ditched '_find_SET()', since it was a no-value-added wrapper around
[python/dscho.git] / Misc / python.man
blob3166a359b8798ae7a5b9b968b49e916df7c5ea12
1 .TH PYTHON "1" "20 August, 1999"
2 .SH NAME
3 python \- an interpreted, interactive, object-oriented programming language
4 .SH SYNOPSIS
5 .B python
7 .B \-d
10 .B \-i
13 .B \-O
16 .B \-S
19 .B \-t
22 .B \-u
25 .B \-v
27 .br
28        [
29 .B \-x
32 .B \-X
34 .br
35        [
36 .B \-c
37 .I command
39 .I script
44 .I arguments
46 .SH DESCRIPTION
47 Python is an interpreted, interactive, object-oriented programming
48 language that combines remarkable power with very clear syntax.
49 For an introduction to programming in Python you are referred to the
50 Python Tutorial.
51 The Python Library Reference documents built-in and standard types,
52 constants, functions and modules.
53 Finally, the Python Reference Manual describes the syntax and
54 semantics of the core language in (perhaps too) much detail.
55 (Information on locating these documents is included in
56 .B "SEE ALSO"
57 below; they may be installed on your system as well.)
58 .PP
59 Python's basic power can be extended with your own modules written in
60 C or C++.
61 On most systems such modules may be dynamically loaded.
62 Python is also adaptable as an extension language for existing
63 applications.
64 See the internal documentation for hints.
65 .SH COMMAND LINE OPTIONS
66 .TP
67 .B \-d
68 Turn on parser debugging output (for wizards only, depending on
69 compilation options).
70 .TP
71 .B \-i
72 When a script is passed as first argument or the \fB\-c\fP option is
73 used, enter interactive mode after executing the script or the
74 command.  It does not read the $PYTHONSTARTUP file.  This can be
75 useful to inspect global variables or a stack trace when a script
76 raises an exception.
77 .TP
78 .B \-O
79 Turn on basic optimizations.  This changes the filename extension for
80 compiled (bytecode) files from
81 .I .pyc
82 to \fI.pyo\fP.  Given twice, causes docstrings to be discarded.
83 .TP
84 .B \-S
85 Disable the import of the module
86 .I site
87 and the site-dependent manipulations of
88 .I sys.path
89 that it entails.
90 .TP
91 .B \-t
92 Issue a warning when a source file mixes tabs and spaces for
93 indentation in a way that makes it depend on the worth of a tab
94 expressed in spaces.  Issue an error when the option is given twice.
95 .TP
96 .B \-u
97 Force stdin, stdout and stderr to be totally unbuffered.
98 .TP
99 .B \-v
100 Print a message each time a module is initialized, showing the place
101 (filename or built-in module) from which it is loaded.  When given
102 twice, print a message for each file that is checked for when 
103 searching for a module.  Also provides information on module cleanup
104 at exit.
106 .B \-x
107 Skip the first line of the source.  This is intended for a DOS
108 specific hack only.  Warning: the line numbers in error messages will
109 be off by one!
111 .B \-X
112 Make the standard exceptions strings instead of classes.
113 Use for backward compatibility with old code only.  This is not
114 necessary for most uses of string exceptions.
116 .BI "\-c " command
117 Specify the command to execute (see next section).
118 This terminates the option list (following options are passed as
119 arguments to the command).
120 .SH INTERPRETER INTERFACE
121 The interpreter interface resembles that of the UNIX shell: when
122 called with standard input connected to a tty device, it prompts for
123 commands and executes them until an EOF is read; when called with a
124 file name argument or with a file as standard input, it reads and
125 executes a
126 .I script
127 from that file;
128 when called with
129 .B \-c
130 .I command,
131 it executes the Python statement(s) given as
132 .I command.
133 Here
134 .I command
135 may contain multiple statements separated by newlines.
136 Leading whitespace is significant in Python statements!
137 In non-interactive mode, the entire input is parsed befored it is
138 executed.
140 If available, the script name and additional arguments thereafter are
141 passed to the script in the Python variable
142 .I sys.argv ,
143 which is a list of strings (you must first
144 .I import sys
145 to be able to access it).
146 If no script name is given,
147 .I sys.argv
148 is empty; if
149 .B \-c
150 is used,
151 .I sys.argv[0]
152 contains the string
153 .I '-c'.
154 Note that options interpreted by the Python interpreter itself
155 are not placed in
156 .I sys.argv.
158 In interactive mode, the primary prompt is `>>>'; the second prompt
159 (which appears when a command is not complete) is `...'.
160 The prompts can be changed by assignment to
161 .I sys.ps1
163 .I sys.ps2.
164 The interpreter quits when it reads an EOF at a prompt.
165 When an unhandled exception occurs, a stack trace is printed and
166 control returns to the primary prompt; in non-interactive mode, the
167 interpreter exits after printing the stack trace.
168 The interrupt signal raises the
169 .I Keyboard\%Interrupt
170 exception; other UNIX signals are not caught (except that SIGPIPE is
171 sometimes ignored, in favor of the
172 .I IOError
173 exception).  Error messages are written to stderr.
174 .SH FILES AND DIRECTORIES
175 These are subject to difference depending on local installation
176 conventions; ${prefix} and ${exec_prefix} are installation-dependent
177 and should be interpreted as for GNU software; they may be the same.
178 The default for both is \fI/usr/local\fP.
179 .IP \fI${exec_prefix}/bin/python\fP
180 Recommended location of the interpreter.
182 .I ${prefix}/lib/python<version>
184 .I ${exec_prefix}/lib/python<version>
186 Recommended locations of the directories containing the standard
187 modules.
190 .I ${prefix}/include/python<version>
192 .I ${exec_prefix}/include/python<version>
194 Recommended locations of the directories containing the include files
195 needed for developing Python extensions and embedding the
196 interpreter.
198 .IP \fI~/.pythonrc.py\fP
199 User-specific initialization file loaded by the \fIuser\fP module;
200 not used by default or by most applications.
201 .SH ENVIRONMENT VARIABLES
202 .IP PYTHONHOME
203 Change the location of the standard Python libraries.  By default, the
204 libraries are searched in ${prefix}/lib/python<version> and
205 ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix}
206 are installation-dependent directories, both defaulting to
207 \fI/usr/local\fP.  When $PYTHONHOME is set to a single directory, its value
208 replaces both ${prefix} and ${exec_prefix}.  To specify different values
209 for these, set $PYTHONHOME to ${prefix}:${exec_prefix}.
210 .IP PYTHONPATH
211 Augments the default search path for module files.
212 The format is the same as the shell's $PATH: one or more directory
213 pathnames separated by colons.
214 Non-existant directories are silently ignored.
215 The default search path is installation dependent, but generally
216 begins with ${prefix}/lib/python<version> (see PYTHONHOME above).
217 The default search path is always appended to $PYTHONPATH.
218 If a script argument is given, the directory containing the script is
219 inserted in the path in front of $PYTHONPATH.
220 The search path can be manipulated from within a Python program as the
221 variable
222 .I sys.path .
223 .IP PYTHONSTARTUP
224 If this is the name of a readable file, the Python commands in that
225 file are executed before the first prompt is displayed in interactive
226 mode.
227 The file is executed in the same name space where interactive commands
228 are executed so that objects defined or imported in it can be used
229 without qualification in the interactive session.
230 You can also change the prompts
231 .I sys.ps1
233 .I sys.ps2
234 in this file.
235 .IP PYTHONDEBUG
236 If this is set to a non-empty string it is equivalent to specifying
237 the \fB\-d\fP option.
238 .IP PYTHONINSPECT
239 If this is set to a non-empty string it is equivalent to specifying
240 the \fB\-i\fP option.
241 .IP PYTHONUNBUFFERED
242 If this is set to a non-empty string it is equivalent to specifying
243 the \fB\-u\fP option.
244 .IP PYTHONVERBOSE
245 If this is set to a non-empty string it is equivalent to specifying
246 the \fB\-v\fP option.
247 .SH SEE ALSO
248 .IP "Python Tutorial"
249 URL: http://www.python.org/doc/tut/tut.html
250 .IP "Python Library Reference"
251 URL: http://www.python.org/doc/lib/lib.html
252 .IP "Python Reference Manual"
253 URL: http://www.python.org/doc/ref/ref.html
254 .IP "Extending and Embedding the Python Interpreter"
255 URL: http://www.python.org/doc/ext/ext.html
256 .IP "Python/C API"
257 URL: http://www.python.org/doc/api/api.html
259 Downloadable versions of these documents in many formats are available
260 at the Python website; see \fB\INTERNET RESOURCES\fP below.
261 .SH AUTHOR
263 Guido van Rossum
264 CNRI
265 1895 Preston White Drive
266 Reston, VA 20191
269 E-mail: guido@cnri.reston.va.us, guido@python.org
272 And a cast of thousands.
273 .SH INTERNET RESOURCES
274 Web site: http://www.python.org
276 FTP site: ftp://ftp.python.org
278 Newsgroups: comp.lang.python, comp.lang.python.announce
280 There are many mirror sites; a current list is available at
281 http://www.python.org/mirrors.html.
283 The \fI\Python Software Activity\fP provides many mailing lists which
284 serve various special interests within the Python community;
285 information on these special interest groups is available at
286 http://www.python.org/sigs/.
287 .SH COPYRIGHT
288 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
289 The Netherlands.
290 .IP " "
291 All Rights Reserved
293 Permission to use, copy, modify, and distribute this software and its
294 documentation for any purpose and without fee is hereby granted,
295 provided that the above copyright notice appear in all copies and that
296 both that copyright notice and this permission notice appear in
297 supporting documentation, and that the names of Stichting Mathematisch
298 Centrum or CWI or Corporation for National Research Initiatives or
299 CNRI not be used in advertising or publicity pertaining to
300 distribution of the software without specific, written prior
301 permission.
303 While CWI is the initial source for this software, a modified version
304 is made available by the Corporation for National Research Initiatives
305 (CNRI) at the Internet address ftp://ftp.python.org.
307 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
308 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
309 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
310 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
311 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
312 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
313 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
314 PERFORMANCE OF THIS SOFTWARE.