Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 1 | .TH PYTHON "1" "5 September, 2000" |
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 | ] |
Guido van Rossum | 07c44c7 | 1998-04-10 19:46:00 +0000 | [diff] [blame] | 27 | [ |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 28 | .B \-x |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 29 | ] |
| 30 | .br |
| 31 | [ |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 32 | .B \-c |
| 33 | .I command |
| 34 | | |
| 35 | .I script |
| 36 | | |
| 37 | \- |
| 38 | ] |
| 39 | [ |
| 40 | .I arguments |
| 41 | ] |
| 42 | .SH DESCRIPTION |
| 43 | Python is an interpreted, interactive, object-oriented programming |
| 44 | language that combines remarkable power with very clear syntax. |
| 45 | For an introduction to programming in Python you are referred to the |
| 46 | Python Tutorial. |
| 47 | The Python Library Reference documents built-in and standard types, |
| 48 | constants, functions and modules. |
| 49 | Finally, the Python Reference Manual describes the syntax and |
| 50 | semantics of the core language in (perhaps too) much detail. |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 51 | (These documents may be located via the |
| 52 | .B "INTERNET RESOURCES" |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 53 | below; they may be installed on your system as well.) |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 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 |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 78 | to \fI.pyo\fP. Given twice, causes docstrings to be discarded. |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 79 | .TP |
| 80 | .B \-S |
| 81 | Disable the import of the module |
| 82 | .I site |
| 83 | and the site-dependent manipulations of |
| 84 | .I sys.path |
| 85 | that it entails. |
| 86 | .TP |
Guido van Rossum | 29d465b | 1998-04-10 19:36:09 +0000 | [diff] [blame] | 87 | .B \-t |
| 88 | Issue a warning when a source file mixes tabs and spaces for |
| 89 | indentation in a way that makes it depend on the worth of a tab |
| 90 | expressed in spaces. Issue an error when the option is given twice. |
| 91 | .TP |
Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 92 | .B \-u |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 93 | Force stdin, stdout and stderr to be totally unbuffered. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 94 | .TP |
| 95 | .B \-v |
| 96 | Print a message each time a module is initialized, showing the place |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 97 | (filename or built-in module) from which it is loaded. When given |
| 98 | twice, print a message for each file that is checked for when |
| 99 | searching for a module. Also provides information on module cleanup |
| 100 | at exit. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 101 | .TP |
Guido van Rossum | 07c44c7 | 1998-04-10 19:46:00 +0000 | [diff] [blame] | 102 | .B \-x |
| 103 | Skip the first line of the source. This is intended for a DOS |
| 104 | specific hack only. Warning: the line numbers in error messages will |
| 105 | be off by one! |
| 106 | .TP |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 107 | .BI "\-c " command |
| 108 | Specify the command to execute (see next section). |
| 109 | This terminates the option list (following options are passed as |
| 110 | arguments to the command). |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 111 | .SH INTERPRETER INTERFACE |
| 112 | The interpreter interface resembles that of the UNIX shell: when |
| 113 | called with standard input connected to a tty device, it prompts for |
| 114 | commands and executes them until an EOF is read; when called with a |
| 115 | file name argument or with a file as standard input, it reads and |
| 116 | executes a |
| 117 | .I script |
| 118 | from that file; |
| 119 | when called with |
| 120 | .B \-c |
| 121 | .I command, |
| 122 | it executes the Python statement(s) given as |
| 123 | .I command. |
| 124 | Here |
| 125 | .I command |
| 126 | may contain multiple statements separated by newlines. |
| 127 | Leading whitespace is significant in Python statements! |
| 128 | In non-interactive mode, the entire input is parsed befored it is |
| 129 | executed. |
| 130 | .PP |
| 131 | If available, the script name and additional arguments thereafter are |
| 132 | passed to the script in the Python variable |
| 133 | .I sys.argv , |
| 134 | which is a list of strings (you must first |
| 135 | .I import sys |
| 136 | to be able to access it). |
| 137 | If no script name is given, |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 138 | .I sys.argv[0] |
| 139 | is an empty string; if |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 140 | .B \-c |
| 141 | is used, |
| 142 | .I sys.argv[0] |
| 143 | contains the string |
| 144 | .I '-c'. |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 145 | Note that options interpreted by the Python interpreter itself |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 146 | are not placed in |
| 147 | .I sys.argv. |
| 148 | .PP |
| 149 | In interactive mode, the primary prompt is `>>>'; the second prompt |
| 150 | (which appears when a command is not complete) is `...'. |
| 151 | The prompts can be changed by assignment to |
| 152 | .I sys.ps1 |
| 153 | or |
| 154 | .I sys.ps2. |
| 155 | The interpreter quits when it reads an EOF at a prompt. |
| 156 | When an unhandled exception occurs, a stack trace is printed and |
| 157 | control returns to the primary prompt; in non-interactive mode, the |
| 158 | interpreter exits after printing the stack trace. |
| 159 | The interrupt signal raises the |
| 160 | .I Keyboard\%Interrupt |
| 161 | exception; other UNIX signals are not caught (except that SIGPIPE is |
| 162 | sometimes ignored, in favor of the |
| 163 | .I IOError |
| 164 | exception). Error messages are written to stderr. |
| 165 | .SH FILES AND DIRECTORIES |
| 166 | These are subject to difference depending on local installation |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 167 | conventions; ${prefix} and ${exec_prefix} are installation-dependent |
| 168 | and should be interpreted as for GNU software; they may be the same. |
| 169 | The default for both is \fI/usr/local\fP. |
| 170 | .IP \fI${exec_prefix}/bin/python\fP |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 171 | Recommended location of the interpreter. |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 172 | .PP |
| 173 | .I ${prefix}/lib/python<version> |
| 174 | .br |
| 175 | .I ${exec_prefix}/lib/python<version> |
| 176 | .RS |
| 177 | Recommended locations of the directories containing the standard |
| 178 | modules. |
| 179 | .RE |
| 180 | .PP |
| 181 | .I ${prefix}/include/python<version> |
| 182 | .br |
| 183 | .I ${exec_prefix}/include/python<version> |
| 184 | .RS |
| 185 | Recommended locations of the directories containing the include files |
| 186 | needed for developing Python extensions and embedding the |
| 187 | interpreter. |
| 188 | .RE |
| 189 | .IP \fI~/.pythonrc.py\fP |
| 190 | User-specific initialization file loaded by the \fIuser\fP module; |
| 191 | not used by default or by most applications. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 192 | .SH ENVIRONMENT VARIABLES |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 193 | .IP PYTHONHOME |
| 194 | Change the location of the standard Python libraries. By default, the |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 195 | libraries are searched in ${prefix}/lib/python<version> and |
| 196 | ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix} |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 197 | are installation-dependent directories, both defaulting to |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 198 | \fI/usr/local\fP. When $PYTHONHOME is set to a single directory, its value |
| 199 | replaces both ${prefix} and ${exec_prefix}. To specify different values |
| 200 | for these, set $PYTHONHOME to ${prefix}:${exec_prefix}. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 201 | .IP PYTHONPATH |
| 202 | Augments the default search path for module files. |
| 203 | The format is the same as the shell's $PATH: one or more directory |
| 204 | pathnames separated by colons. |
| 205 | Non-existant directories are silently ignored. |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 206 | The default search path is installation dependent, but generally |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 207 | begins with ${prefix}/lib/python<version> (see PYTHONHOME above). |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 208 | The default search path is always appended to $PYTHONPATH. |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 209 | If a script argument is given, the directory containing the script is |
| 210 | inserted in the path in front of $PYTHONPATH. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 211 | The search path can be manipulated from within a Python program as the |
| 212 | variable |
| 213 | .I sys.path . |
| 214 | .IP PYTHONSTARTUP |
| 215 | If this is the name of a readable file, the Python commands in that |
| 216 | file are executed before the first prompt is displayed in interactive |
| 217 | mode. |
| 218 | The file is executed in the same name space where interactive commands |
| 219 | are executed so that objects defined or imported in it can be used |
| 220 | without qualification in the interactive session. |
| 221 | You can also change the prompts |
| 222 | .I sys.ps1 |
| 223 | and |
| 224 | .I sys.ps2 |
| 225 | in this file. |
| 226 | .IP PYTHONDEBUG |
| 227 | If this is set to a non-empty string it is equivalent to specifying |
| 228 | the \fB\-d\fP option. |
| 229 | .IP PYTHONINSPECT |
| 230 | If this is set to a non-empty string it is equivalent to specifying |
| 231 | the \fB\-i\fP option. |
Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 232 | .IP PYTHONUNBUFFERED |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 233 | 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] | 234 | the \fB\-u\fP option. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 235 | .IP PYTHONVERBOSE |
| 236 | If this is set to a non-empty string it is equivalent to specifying |
| 237 | the \fB\-v\fP option. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 238 | .SH AUTHOR |
| 239 | .nf |
| 240 | Guido van Rossum |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 241 | BeOpen.com |
| 242 | 160 Saratoga Avenue |
| 243 | Santa Clara, CA 95051 |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 244 | USA |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 245 | .PP |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 246 | E-mail: guido@beopen.com, guido@python.org |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 247 | .fi |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 248 | .PP |
| 249 | And a cast of thousands. |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 250 | .SH INTERNET RESOURCES |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 251 | Main website: http://www.python.org |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 252 | .br |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 253 | BeOpen development team: http://pythonlabs.com |
| 254 | .br |
| 255 | Community website: http://starship.python.net |
| 256 | .br |
| 257 | Developer resources: |
| 258 | .br |
| 259 | http://sourceforge.net/project/?group_id=5470 |
| 260 | .br |
| 261 | FTP: ftp://ftp.python.org/pub/python |
| 262 | .br |
| 263 | Module repository: http://www.vex.net/parnassus/ |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 264 | .br |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 265 | Newsgroups: comp.lang.python, comp.lang.python.announce |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 266 | .SH LICENSING |
| 267 | Python is distributed under an Open Source license. See the file |
| 268 | "LICENSE" in the Python source distribution for information on terms & |
| 269 | conditions for accessing and otherwise using Python and for a |
| 270 | DISCLAIMER OF ALL WARRANTIES. |