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