Penguin
Annotated edit history of python(1) version 2, including all changes. View license author blame.
Rev Author # Line
1 perry 1 PYTHON
2 !!!PYTHON
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 COMMAND LINE OPTIONS
7 INTERPRETER INTERFACE
8 FILES AND DIRECTORIES
9 ENVIRONMENT VARIABLES
10 AUTHOR
11 INTERNET RESOURCES
12 LICENSING
13 ----
14 !!NAME
15
16
17 python - an interpreted, interactive, object-oriented programming language
18 !!SYNOPSIS
19
20
21 __python__ [[ __-d__ ] [[ __-i__ ] [[ __-O__ ] [[
22 __-S__ ] [[ __-t__ ] [[ __-u__ ] [[ __-v__ ] [[
23 __-x__ ] [[ __-h__ ] [[ __-V__ ] [[ __-W__
24 ''argument'' ]
25 [[ __-c__ ''command'' | ''script'' | - ] [[
26 ''arguments'' ]
27 !!DESCRIPTION
28
29
30 Python is an interpreted, interactive, object-oriented
31 programming language that combines remarkable power with
32 very clear syntax. For an introduction to programming in
33 Python you are referred to the Python Tutorial. The Python
34 Library Reference documents built-in and standard types,
35 constants, functions and modules. Finally, the Python
36 Reference Manual describes the syntax and semantics of the
37 core language in (perhaps too) much detail. (These documents
38 may be located via the __INTERNET RESOURCES__ below; they
39 may be installed on your system as well.)
40
41
42 Python's basic power can be extended with your own modules
43 written in C or C++. On most systems such modules may be
44 dynamically loaded. Python is also adaptable as an extension
45 language for existing applications. See the internal
46 documentation for hints.
47
48
49 Documentation for installed Python modules and packages can
50 be viewed by running the __pydoc__ program.
51 !!COMMAND LINE OPTIONS
52
53
54 __-d__
55
56
57 Turn on parser debugging output (for wizards only, depending
58 on compilation options).
59
60
61 __-i__
62
63
64 When a script is passed as first argument or the __-c__
65 option is used, enter interactive mode after executing the
66 script or the command. It does not read the $PYTHONSTARTUP
67 file. This can be useful to inspect global variables or a
68 stack trace when a script raises an exception.
69
70
71 __-O__
72
73
74 Turn on basic optimizations. This changes the filename
75 extension for compiled (bytecode) files from ''.pyc'' to
76 ''.pyo''. Given twice, causes docstrings to be
77 discarded.
78
79
80 __-S__
81
82
83 Disable the import of the module ''site'' and the
84 site-dependent manipulations of ''sys.path'' that it
85 entails.
86
87
88 __-t__
89
90
91 Issue a warning when a source file mixes tabs and spaces for
92 indentation in a way that makes it depend on the worth of a
93 tab expressed in spaces. Issue an error when the option is
94 given twice.
95
96
97 __-u__
98
99
100 Force stdin, stdout and stderr to be totally
101 unbuffered.
102
103
104 __-v__
105
106
107 Print a message each time a module is initialized, showing
108 the place (filename or built-in module) from which it is
109 loaded. When given twice, print a message for each file that
110 is checked for when searching for a module. Also provides
111 information on module cleanup at exit.
112
113
114 __-x__
115
116
117 Skip the first line of the source. This is intended for a
118 DOS specific hack only. Warning: the line numbers in error
119 messages will be off by one!
120
121
122 __-h__
123
124
125 Prints the usage for the interpreter executable and
126 exits.
127
128
129 __-V__
130
131
132 Prints the Python version number of the executable and
133 exits.
134
135
136 __-W__ ''argument''
137
138
139 Warning control. Python sometimes prints warning message to
140 ''sys.stderr''. A typical warning message has the
141 following form: ''file''__:__''line''__:__
142 ''category''__:__ ''message.'' By default, each
143 warning is printed once for each source line where it
144 occurs. This option controls how often warnings are printed.
145 Multiple __-W__ options may be given; when a warning
146 matches more than one option, the action for the last
147 matching option is performed. Invalid __-W__ options are
148 ignored (a warning message is printed about invalid options
149 when the first warning is issued). Warnings can also be
150 controlled from within a Python program using the
151 ''warnings'' module.
152
153
154 The simplest form of ''argument'' is one of the following
155 ''action'' strings (or a unique abbreviation):
156 __ignore__ to ignore all warnings; __default__ to
157 explicitly request the default behavior (printing each
158 warning once per source line); __all__ to print a warning
159 each time it occurs (this may generate many messages if a
160 warning is triggered repeatedly for the same source line,
161 e.g. inside a loop); __module__ to print each warning
162 only only the first time it occurs in each module;
163 __once__ to print each warning only the first time it
164 occurs in the program; or __error__ to raise an exception
165 instead of printing a warning message.
166
167
168 The full form of ''argument'' is
169 ''action''__:__''message''__:__''category''__:__''module''__:__''line.''
170 Here, ''action'' is as explained above but only applies
171 to messages that match the remaining fields. Empty fields
172 match all values; trailing empty fields may be omitted. The
173 ''message'' field matches the start of the warning
174 message printed; this match is case-insensitive. The
175 ''category'' field matches the warning category. This
176 must be a class name; the match test whether the actual
177 warning category of the message is a subclass of the
178 specified warning category. The full class name must be
179 given. The ''module'' field matches the (fully-qualified)
180 module name; this match is case-sensitive. The ''line''
181 field matches the line number, where zero matches all line
182 numbers and is thus equivalent to an omitted line
183 number.
184
185
186 __-c__ ''command''
187
188
189 Specify the command to execute (see next section). This
190 terminates the option list (following options are passed as
191 arguments to the command).
192 !!INTERPRETER INTERFACE
193
194
195 The interpreter interface resembles that of the UNIX shell:
196 when called with standard input connected to a tty device,
197 it prompts for commands and executes them until an EOF is
198 read; when called with a file name argument or with a file
199 as standard input, it reads and executes a ''script''
200 from that file; when called with __-c__ ''command,''
201 it executes the Python statement(s) given as ''command.''
202 Here ''command'' may contain multiple statements
203 separated by newlines. Leading whitespace is significant in
204 Python statements! In non-interactive mode, the entire input
205 is parsed befored it is executed.
206
207
208 If available, the script name and additional arguments
209 thereafter are passed to the script in the Python variable
210 ''sys.argv ,'' which is a list of strings (you must first
211 ''import sys'' to be able to access it). If no script
212 name is given, ''sys.argv[[0]'' is an empty string; if
213 __-c__ is used, ''sys.argv[[0]'' contains the string
214 '''-c'.'' Note that options interpreted by the Python
215 interpreter itself are not placed in
216 ''sys.argv.''
217
218
219 In interactive mode, the primary prompt is `
220 sys.ps1'' or ''sys.ps2.'' The interpreter quits
221 when it reads an EOF at a prompt. When an unhandled
222 exception occurs, a stack trace is printed and control
223 returns to the primary prompt; in non-interactive mode, the
224 interpreter exits after printing the stack trace. The
2 perry 225 interrupt signal raises the ''!KeyboardInterrupt''
1 perry 226 exception; other UNIX signals are not caught (except that
227 SIGPIPE is sometimes ignored, in favor of the ''IOError''
228 exception). Error messages are written to
229 stderr.
230 !!FILES AND DIRECTORIES
231
232
233 These are subject to difference depending on local
234 installation conventions; ${prefix} and ${exec_prefix} are
235 installation-dependent and should be interpreted as for GNU
236 software; they may be the same. The default for both is
237 ''/usr/local''.
238
239
240 ''${exec_prefix}/bin/python''
241
242
243 Recommended location of the interpreter.
244
245
246 ''${prefix}/lib/python''
247 ${exec_prefix}/lib/python''
248
249
250 Recommended locations of the directories containing the
251 standard modules.
252
253
254 ''${prefix}/include/python''
255 ${exec_prefix}/include/python''
256
257
258 Recommended locations of the directories containing the
259 include files needed for developing Python extensions and
260 embedding the interpreter.
261
262
263 ''~/.pythonrc.py''
264
265
266 User-specific initialization file loaded by the ''user''
267 module; not used by default or by most
268 applications.
269 !!ENVIRONMENT VARIABLES
270
271
272 PYTHONHOME
273
274
275 Change the location of the standard Python libraries. By
276 default, the libraries are searched in
277 ${prefix}/lib/python
278 /usr/local''. When $PYTHONHOME is
279 set to a single directory, its value replaces both ${prefix}
280 and ${exec_prefix}. To specify different values for these,
281 set $PYTHONHOME to ${prefix}:${exec_prefix}.
282
283
284 PYTHONPATH
285
286
287 Augments the default search path for module files. The
288 format is the same as the shell's $PATH: one or more
289 directory pathnames separated by colons. Non-existant
290 directories are silently ignored. The default search path is
291 installation dependent, but generally begins with
292 ${prefix}/lib/python
293 sys.path .''
294
295
296 PYTHONSTARTUP
297
298
299 If this is the name of a readable file, the Python commands
300 in that file are executed before the first prompt is
301 displayed in interactive mode. The file is executed in the
302 same name space where interactive commands are executed so
303 that objects defined or imported in it can be used without
304 qualification in the interactive session. You can also
305 change the prompts ''sys.ps1'' and ''sys.ps2'' in this
306 file.
307
308
309 PYTHONDEBUG
310
311
312 If this is set to a non-empty string it is equivalent to
313 specifying the __-d__ option.
314
315
316 PYTHONINSPECT
317
318
319 If this is set to a non-empty string it is equivalent to
320 specifying the __-i__ option.
321
322
323 PYTHONUNBUFFERED
324
325
326 If this is set to a non-empty string it is equivalent to
327 specifying the __-u__ option.
328
329
330 PYTHONVERBOSE
331
332
333 If this is set to a non-empty string it is equivalent to
334 specifying the __-v__ option.
335 !!AUTHOR
336
337
338 Guido van Rossum
339 E-mail: guido@python.org
340 And a cast of thousands.
341 !!INTERNET RESOURCES
342
343
344 Main website: http://www.python.org
345 Community website: http://starship.python.net
346 Developer resources:
347 http://sourceforge.net/project/?group_id=5470
348 FTP: ftp://ftp.python.org/pub/python
349 Module repository: http://www.vex.net/parnassus/
350 Newsgroups: comp.lang.python,
351 comp.lang.python.announce
352 !!LICENSING
353
354
355 Python is distributed under an Open Source license. See the
356 file
357 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.