Guido van Rossum | 29d465b | 1998-04-10 19:36:09 +0000 | [diff] [blame] | 1 | .TH PYTHON "10 April, 1998" |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 2 | .SH NAME |
| 3 | python \- an interpreted, interactive, object-oriented programming language |
| 4 | .SH SYNOPSIS |
| 5 | .B python |
| 6 | [ |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 7 | .B \-d |
| 8 | ] |
| 9 | [ |
| 10 | .B \-i |
| 11 | ] |
| 12 | [ |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 13 | .B \-O |
| 14 | ] |
| 15 | [ |
| 16 | .B \-S |
| 17 | ] |
| 18 | [ |
Guido van Rossum | 29d465b | 1998-04-10 19:36:09 +0000 | [diff] [blame] | 19 | .B \-t |
| 20 | ] |
| 21 | [ |
Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 22 | .B \-u |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 23 | ] |
| 24 | [ |
| 25 | .B \-v |
| 26 | ] |
| 27 | [ |
Guido van Rossum | 07c44c7 | 1998-04-10 19:46:00 +0000 | [diff] [blame^] | 28 | .B \-x |
| 29 | ] |
| 30 | [ |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 31 | .B \-X |
| 32 | ] |
| 33 | .br |
| 34 | [ |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 35 | .B \-c |
| 36 | .I command |
| 37 | | |
| 38 | .I script |
| 39 | | |
| 40 | \- |
| 41 | ] |
| 42 | [ |
| 43 | .I arguments |
| 44 | ] |
| 45 | .SH DESCRIPTION |
| 46 | Python is an interpreted, interactive, object-oriented programming |
| 47 | language that combines remarkable power with very clear syntax. |
| 48 | For an introduction to programming in Python you are referred to the |
| 49 | Python Tutorial. |
| 50 | The Python Library Reference documents built-in and standard types, |
| 51 | constants, functions and modules. |
| 52 | Finally, the Python Reference Manual describes the syntax and |
| 53 | semantics of the core language in (perhaps too) much detail. |
| 54 | .PP |
| 55 | Python's basic power can be extended with your own modules written in |
| 56 | C or C++. |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 57 | On most systems such modules may be dynamically loaded. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 58 | Python is also adaptable as an extension language for existing |
| 59 | applications. |
| 60 | See the internal documentation for hints. |
| 61 | .SH COMMAND LINE OPTIONS |
| 62 | .TP |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 63 | .B \-d |
| 64 | Turn on parser debugging output (for wizards only, depending on |
| 65 | compilation options). |
Guido van Rossum | 9f65ae0 | 1994-02-23 09:10:27 +0000 | [diff] [blame] | 66 | .TP |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 67 | .B \-i |
| 68 | When a script is passed as first argument or the \fB\-c\fP option is |
| 69 | used, enter interactive mode after executing the script or the |
Guido van Rossum | 9f65ae0 | 1994-02-23 09:10:27 +0000 | [diff] [blame] | 70 | command. It does not read the $PYTHONSTARTUP file. This can be |
| 71 | useful to inspect global variables or a stack trace when a script |
| 72 | raises an exception. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 73 | .TP |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 74 | .B \-O |
| 75 | Turn on basic optimizations. This changes the filename extension for |
| 76 | compiled (bytecode) files from |
| 77 | .I .pyc |
| 78 | to |
| 79 | .I pyo. |
| 80 | .TP |
| 81 | .B \-S |
| 82 | Disable the import of the module |
| 83 | .I site |
| 84 | and the site-dependent manipulations of |
| 85 | .I sys.path |
| 86 | that it entails. |
| 87 | .TP |
Guido van Rossum | 29d465b | 1998-04-10 19:36:09 +0000 | [diff] [blame] | 88 | .B \-t |
| 89 | Issue a warning when a source file mixes tabs and spaces for |
| 90 | indentation in a way that makes it depend on the worth of a tab |
| 91 | expressed in spaces. Issue an error when the option is given twice. |
| 92 | .TP |
Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 93 | .B \-u |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 94 | Force stdin, stdout and stderr to be totally unbuffered. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 95 | .TP |
| 96 | .B \-v |
| 97 | Print a message each time a module is initialized, showing the place |
| 98 | (filename or built-in module) from which it is loaded. |
| 99 | .TP |
Guido van Rossum | 07c44c7 | 1998-04-10 19:46:00 +0000 | [diff] [blame^] | 100 | .B \-x |
| 101 | Skip the first line of the source. This is intended for a DOS |
| 102 | specific hack only. Warning: the line numbers in error messages will |
| 103 | be off by one! |
| 104 | .TP |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 105 | .B \-X |
| 106 | Make the standard exceptions strings instead of classes. |
| 107 | Use for backward compatibility with old code only. |
| 108 | .TP |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 109 | .BI "\-c " command |
| 110 | Specify the command to execute (see next section). |
| 111 | This terminates the option list (following options are passed as |
| 112 | arguments to the command). |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 113 | .SH INTERPRETER INTERFACE |
| 114 | The interpreter interface resembles that of the UNIX shell: when |
| 115 | called with standard input connected to a tty device, it prompts for |
| 116 | commands and executes them until an EOF is read; when called with a |
| 117 | file name argument or with a file as standard input, it reads and |
| 118 | executes a |
| 119 | .I script |
| 120 | from that file; |
| 121 | when called with |
| 122 | .B \-c |
| 123 | .I command, |
| 124 | it executes the Python statement(s) given as |
| 125 | .I command. |
| 126 | Here |
| 127 | .I command |
| 128 | may contain multiple statements separated by newlines. |
| 129 | Leading whitespace is significant in Python statements! |
| 130 | In non-interactive mode, the entire input is parsed befored it is |
| 131 | executed. |
| 132 | .PP |
| 133 | If available, the script name and additional arguments thereafter are |
| 134 | passed to the script in the Python variable |
| 135 | .I sys.argv , |
| 136 | which is a list of strings (you must first |
| 137 | .I import sys |
| 138 | to be able to access it). |
| 139 | If no script name is given, |
| 140 | .I sys.argv |
| 141 | is empty; if |
| 142 | .B \-c |
| 143 | is used, |
| 144 | .I sys.argv[0] |
| 145 | contains the string |
| 146 | .I '-c'. |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 147 | Note that options interpreted by the Python interpreter itself |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 148 | are not placed in |
| 149 | .I sys.argv. |
| 150 | .PP |
| 151 | In interactive mode, the primary prompt is `>>>'; the second prompt |
| 152 | (which appears when a command is not complete) is `...'. |
| 153 | The prompts can be changed by assignment to |
| 154 | .I sys.ps1 |
| 155 | or |
| 156 | .I sys.ps2. |
| 157 | The interpreter quits when it reads an EOF at a prompt. |
| 158 | When an unhandled exception occurs, a stack trace is printed and |
| 159 | control returns to the primary prompt; in non-interactive mode, the |
| 160 | interpreter exits after printing the stack trace. |
| 161 | The interrupt signal raises the |
| 162 | .I Keyboard\%Interrupt |
| 163 | exception; other UNIX signals are not caught (except that SIGPIPE is |
| 164 | sometimes ignored, in favor of the |
| 165 | .I IOError |
| 166 | exception). Error messages are written to stderr. |
| 167 | .SH FILES AND DIRECTORIES |
| 168 | These are subject to difference depending on local installation |
| 169 | conventions: |
| 170 | .IP /usr/local/bin/python |
| 171 | Recommended location of the interpreter. |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 172 | .IP /usr/local/lib/python<version> |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 173 | Recommended location of the directory containing the standard modules. |
| 174 | .SH ENVIRONMENT VARIABLES |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 175 | .IP PYTHONHOME |
| 176 | Change the location of the standard Python libraries. By default, the |
| 177 | libraries are searched in <prefix>/lib/python<version> and |
| 178 | <exec_prefix>/lib/python<version>, where <prefix> and <exec_prefix> |
| 179 | are installation-dependent directories, both defaulting to |
| 180 | /usr/local. When $PYTHONHOME is set to a single directory, its value |
| 181 | replaces both <prefix> and <exec_prefix>. To specify different values |
| 182 | for these, set $PYTHONHOME to <prefix>:<exec_prefix>. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 183 | .IP PYTHONPATH |
| 184 | Augments the default search path for module files. |
| 185 | The format is the same as the shell's $PATH: one or more directory |
| 186 | pathnames separated by colons. |
| 187 | Non-existant directories are silently ignored. |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 188 | The default search path is installation dependent, but generally |
| 189 | begins with <prefix>/lib/python<version> (see PYTHONHOME below). |
| 190 | The default search path is always appended to $PYTHONPATH. |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 191 | If a script argument is given, the directory containing the script is |
| 192 | inserted in the path in front of $PYTHONPATH. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 193 | The search path can be manipulated from within a Python program as the |
| 194 | variable |
| 195 | .I sys.path . |
| 196 | .IP PYTHONSTARTUP |
| 197 | If this is the name of a readable file, the Python commands in that |
| 198 | file are executed before the first prompt is displayed in interactive |
| 199 | mode. |
| 200 | The file is executed in the same name space where interactive commands |
| 201 | are executed so that objects defined or imported in it can be used |
| 202 | without qualification in the interactive session. |
| 203 | You can also change the prompts |
| 204 | .I sys.ps1 |
| 205 | and |
| 206 | .I sys.ps2 |
| 207 | in this file. |
| 208 | .IP PYTHONDEBUG |
| 209 | If this is set to a non-empty string it is equivalent to specifying |
| 210 | the \fB\-d\fP option. |
| 211 | .IP PYTHONINSPECT |
| 212 | If this is set to a non-empty string it is equivalent to specifying |
| 213 | the \fB\-i\fP option. |
Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 214 | .IP PYTHONUNBUFFERED |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 215 | If this is set to a non-empty string it is equivalent to specifying |
Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 216 | the \fB\-u\fP option. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 217 | .IP PYTHONVERBOSE |
| 218 | If this is set to a non-empty string it is equivalent to specifying |
| 219 | the \fB\-v\fP option. |
| 220 | .SH SEE ALSO |
| 221 | Python Tutorial |
| 222 | .br |
| 223 | Python Library Reference |
| 224 | .br |
| 225 | Python Reference Manual |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 226 | .SH AUTHOR |
| 227 | .nf |
| 228 | Guido van Rossum |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 229 | CNRI |
| 230 | 1895 Preston White Drive |
| 231 | Reston, VA 20191 |
| 232 | USA |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 233 | .PP |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 234 | E-mail: guido@cnri.reston.va.us, guido@python.org |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 235 | .fi |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 236 | .PP |
| 237 | And a cast of thousands. |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 238 | .SH INTERNET RESOURCES |
| 239 | Web site: http://www.python.org |
| 240 | .br |
| 241 | FTP site: ftp://ftp.python.org |
| 242 | .br |
| 243 | Newsgroup: comp.lang.python |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 244 | .SH COPYRIGHT |
Guido van Rossum | 227a0a1 | 1995-01-04 19:21:21 +0000 | [diff] [blame] | 245 | Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
| 246 | The Netherlands. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 247 | .IP " " |
| 248 | All Rights Reserved |
| 249 | .PP |
Guido van Rossum | 227a0a1 | 1995-01-04 19:21:21 +0000 | [diff] [blame] | 250 | Permission to use, copy, modify, and distribute this software and its |
| 251 | documentation for any purpose and without fee is hereby granted, |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 252 | provided that the above copyright notice appear in all copies and that |
Guido van Rossum | 227a0a1 | 1995-01-04 19:21:21 +0000 | [diff] [blame] | 253 | both that copyright notice and this permission notice appear in |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 254 | supporting documentation, and that the names of Stichting Mathematisch |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame] | 255 | Centrum or CWI or Corporation for National Research Initiatives or |
| 256 | CNRI not be used in advertising or publicity pertaining to |
| 257 | distribution of the software without specific, written prior |
| 258 | permission. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 259 | |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame] | 260 | While CWI is the initial source for this software, a modified version |
| 261 | is made available by the Corporation for National Research Initiatives |
| 262 | (CNRI) at the Internet address ftp://ftp.python.org. |
| 263 | |
| 264 | STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
| 265 | REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
| 266 | MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
| 267 | CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
| 268 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 269 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 270 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 271 | PERFORMANCE OF THIS SOFTWARE. |