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