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