Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6c4f0032
Commit
6c4f0032
authored
Mar 07, 1995
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes (suggested) by Soren Larsen
parent
d01c1007
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
92 additions
and
80 deletions
+92
-80
Doc/lib/libarray.tex
Doc/lib/libarray.tex
+2
-2
Doc/lib/libcgi.tex
Doc/lib/libcgi.tex
+6
-2
Doc/lib/libfuncs.tex
Doc/lib/libfuncs.tex
+11
-9
Doc/lib/libhttplib.tex
Doc/lib/libhttplib.tex
+2
-2
Doc/lib/libimp.tex
Doc/lib/libimp.tex
+1
-1
Doc/lib/libpdb.tex
Doc/lib/libpdb.tex
+1
-1
Doc/lib/libprofile.tex
Doc/lib/libprofile.tex
+1
-1
Doc/lib/libregex.tex
Doc/lib/libregex.tex
+2
-2
Doc/lib/librfc822.tex
Doc/lib/librfc822.tex
+5
-5
Doc/lib/libsgmllib.tex
Doc/lib/libsgmllib.tex
+4
-4
Doc/lib/libstruct.tex
Doc/lib/libstruct.tex
+3
-3
Doc/lib/libsys.tex
Doc/lib/libsys.tex
+1
-1
Doc/lib/libtime.tex
Doc/lib/libtime.tex
+4
-4
Doc/lib/liburllib.tex
Doc/lib/liburllib.tex
+3
-3
Doc/libarray.tex
Doc/libarray.tex
+2
-2
Doc/libcgi.tex
Doc/libcgi.tex
+6
-2
Doc/libfuncs.tex
Doc/libfuncs.tex
+11
-9
Doc/libhttplib.tex
Doc/libhttplib.tex
+2
-2
Doc/libimp.tex
Doc/libimp.tex
+1
-1
Doc/libpdb.tex
Doc/libpdb.tex
+1
-1
Doc/libprofile.tex
Doc/libprofile.tex
+1
-1
Doc/libregex.tex
Doc/libregex.tex
+2
-2
Doc/librfc822.tex
Doc/librfc822.tex
+5
-5
Doc/libsgmllib.tex
Doc/libsgmllib.tex
+4
-4
Doc/libstruct.tex
Doc/libstruct.tex
+3
-3
Doc/libsys.tex
Doc/libsys.tex
+1
-1
Doc/libtime.tex
Doc/libtime.tex
+4
-4
Doc/liburllib.tex
Doc/liburllib.tex
+3
-3
No files found.
Doc/lib/libarray.tex
View file @
6c4f0032
...
...
@@ -63,8 +63,8 @@ available are still inserted into the array.
\end{funcdesc}
\begin{funcdesc}
{
fromlist
}{
list
}
Append
s
items from the list. This is equivalent to
\code
{
for x in
\var
{
list
}
: a.append(x)
}
Append items from the list. This is equivalent to
\code
{
for x in
\var
{
list
}
:
\
a.append(x)
}
except that if there is a type error, the array is unchanged.
\end{funcdesc}
...
...
Doc/lib/libcgi.tex
View file @
6c4f0032
...
...
@@ -62,7 +62,9 @@ most once per script invocation, as it may consume standard input (if
the form was submitted through a POST request). The keys in the
resulting dictionary are the field names used in the submission; the
values are
{
\em
lists
}
of the field values (since field name may be
used multiple times in a single form). As a side effect, it sets
used multiple times in a single form).
\samp
{
\%
}
escapes in the
values are translated to their single-character equivalent using
\code
{
urllib.unquote()
}
. As a side effect, this function sets
\code
{
environ['QUERY
_
STRING']
}
to the raw query string, if it isn't
already set.
\end{funcdesc}
...
...
@@ -79,7 +81,9 @@ environment. This is mainly useful when debugging a CGI script.
\end{funcdesc}
\begin{funcdesc}
{
print
_
form
}{
form
}
Print a piece of HTML text showing the contents of the
\var
{
form
}
.
Print a piece of HTML text showing the contents of the
\var
{
form
}
(a
dictionary, an instance of the
\code
{
FormContentDict
}
class defined
below, or a subclass thereof).
This is mainly useful when debugging a CGI script.
\end{funcdesc}
...
...
Doc/lib/libfuncs.tex
View file @
6c4f0032
...
...
@@ -42,7 +42,7 @@ exactly one argument.)
\begin{funcdesc}
{
compile
}{
string
\,
filename
\,
kind
}
Compile the
\var
{
string
}
into a code object. Code objects can be
executed by a
\code
{
exec()
}
statement or evaluated by a call to
executed by a
n
\code
{
exec
}
statement or evaluated by a call to
\code
{
eval()
}
. The
\var
{
filename
}
argument should
give the file from which the code was read; pass e.g.
\code
{
'<string>'
}
if it wasn't read from a file. The
\var
{
kind
}
argument specifies
...
...
@@ -56,7 +56,7 @@ exactly one argument.)
object and a string. The string must be the name
of one of the object's attributes. The function deletes
the named attribute, provided the object allows it. For example,
\code
{
set
attr(
\var
{
x
}
, '
\var
{
foobar
}
')
}
is equivalent to
\code
{
del
attr(
\var
{
x
}
, '
\var
{
foobar
}
')
}
is equivalent to
\code
{
del
\var
{
x
}
.
\var
{
foobar
}}
.
\end{funcdesc}
...
...
@@ -106,13 +106,15 @@ exactly one argument.)
\end{verbatim}
\ecode
This function can also be used to execute arbitrary code objects
(e.g. created by
\code
{
compile()
}
). In this case pass a code
(e.g.
\
created by
\code
{
compile()
}
). In this case pass a code
object instead of a string. The code object must have been compiled
passing
\code
{
'eval'
}
to the
\var
{
kind
}
argument.
Note
: dynamic execution of statements is supported by the
Hints
: dynamic execution of statements is supported by the
\code
{
exec
}
statement. Execution of statements from a file is
supported by the
\code
{
execfile()
}
function.
supported by the
\code
{
execfile()
}
function. The
\code
{
vars()
}
function returns the current local dictionary, which may be useful
to pass around for use by
\code
{
eval()
}
or
\code
{
execfile()
}
.
\end{funcdesc}
...
...
@@ -138,7 +140,7 @@ Construct a list from those elements of \var{list} for which
\var
{
function
}
returns true. If
\var
{
list
}
is a string or a tuple,
the result also has that type; otherwise it is always a list. If
\var
{
function
}
is
\code
{
None
}
, the identity function is assumed,
i.e. all elements of
\var
{
list
}
that are false (zero or empty) are
i.e.
\
all elements of
\var
{
list
}
that are false (zero or empty) are
removed.
\end{funcdesc}
...
...
@@ -268,7 +270,7 @@ there's no reliable way to determine whether this is the case.}
\begin{funcdesc}
{
pow
}{
x
\,
y
\optional
{
\,
z
}}
Return
\var
{
x
}
to the power
\var
{
y
}
; if
\var
{
z
}
is present, return
\var
{
x
}
to the power
\var
{
y
}
, modulo
\var
{
z
}
(computed more
efficiently tha
t
\code
{
pow(
\var
{
x
}
,
\var
{
y
}
)
\%
\var
{
z
}}
).
efficiently tha
n
\code
{
pow(
\var
{
x
}
,
\var
{
y
}
)
\%
\var
{
z
}}
).
The arguments must have
numeric types. With mixed operand types, the rules for binary
arithmetic operators apply. The effective operand type is also the
...
...
@@ -378,7 +380,7 @@ when passed to \code{eval()}.
\begin{funcdesc}
{
str
}{
object
}
Return a string containing a nicely printable representation of an
object. For strings, this returns the string itself. The difference
with
\code
{
repr(
\var
{
object
}
}
is that
\code
{
str(
\var
{
object
}
}
does not
with
\code
{
repr(
\var
{
object
}
)
}
is that
\code
{
str(
\var
{
object
}
)
}
does not
always attempt to return a string that is acceptable to
\code
{
eval()
}
;
its goal is to return a printable string.
\end{funcdesc}
...
...
@@ -412,7 +414,7 @@ The returned dictionary should not be modified: the effects on the
corresponding symbol table are undefined.
%
\footnote
{
In the current implementation, local variable bindings
cannot normally be affected this way, but variables retrieved from
other scopes can be. This may change.
}
other scopes
(e.g. modules)
can be. This may change.
}
\end{funcdesc}
\begin{funcdesc}
{
xrange
}{
\optional
{
start
\,
}
end
\optional
{
\,
step
}}
...
...
Doc/lib/libhttplib.tex
View file @
6c4f0032
...
...
@@ -6,7 +6,7 @@
This module defines a class which implements the client side of the
HTTP protocol. It is normally not used directly --- the module
\code
{
urll
lib
}
module
uses it to handle URLs that use HTTP.
\code
{
urll
ib
}
uses it to handle URLs that use HTTP.
\stmodindex
{
urllib
}
The module defines one class,
\code
{
HTTP
}
. An
\code
{
HTTP
}
instance
...
...
@@ -80,7 +80,7 @@ Send a blank line to the server, signalling the end of the headers.
Complete the request by shutting down the sending end of the socket,
read the reply from the server, and return a triple (
\var
{
replycode
}
,
\var
{
message
}
,
\var
{
headers
}
). Here
\var
{
replycode
}
is the integer
reply code from the request (e.g.
\code
{
200
}
if the request was
reply code from the request (e.g.
\
\code
{
200
}
if the request was
handled properly);
\var
{
message
}
is the message string corresponding
to the reply code; and
\var
{
header
}
is an instance of the class
\code
{
rfc822.Message
}
containing the headers received from the server.
...
...
Doc/lib/libimp.tex
View file @
6c4f0032
...
...
@@ -2,7 +2,7 @@
\bimodindex
{
imp
}
\index
{
import
}
This module provides an interface to the mechanisms use to implement
This module provides an interface to the mechanisms use
d
to implement
the
\code
{
import
}
statement. It defines the following constants and
functions:
...
...
Doc/lib/libpdb.tex
View file @
6c4f0032
...
...
@@ -99,7 +99,7 @@ either ``\code{h}'' or ``\code{help}'' can be used to enter the help
command (but not ``
\code
{
he
}
'' or ``
\code
{
hel
}
'', nor ``
\code
{
H
}
'' or
``
\code
{
Help
}
or ``
\code
{
HELP
}
''). Arguments to commands must be
separated by whitespace (spaces or tabs). Optional arguments are
enclosed in square brackets (``
\code
{
[]
}
'')in the command syntax; the
enclosed in square brackets (``
\code
{
[]
}
'')
in the command syntax; the
square brackets must not be typed. Alternatives in the command syntax
are separated by a vertical bar (``
\code
{
|
}
'').
...
...
Doc/lib/libprofile.tex
View file @
6c4f0032
...
...
@@ -6,7 +6,7 @@ Copyright 1994, by InfoSeek Corporation, all rights reserved.
Written by James Roskind
%
\footnote
{
Updated and converted to
LaTeX
by Guido van Rossum. The references to
Updated and converted to
\LaTeX\
by Guido van Rossum. The references to
the old profiler are left in the text, although it no longer exists.
}
...
...
Doc/lib/libregex.tex
View file @
6c4f0032
...
...
@@ -19,7 +19,7 @@ is because Python doesn't remove backslashes from string literals if
they are followed by an unrecognized escape character.
\emph
{
However
}
, if you want to include a literal
\dfn
{
backslash
}
in a
regular expression represented as a string literal, you have to
\emph
{
quadruple
}
it. E.g.
to extract LaTeX
\samp
{
\e
section
\{
{
\rm
\emph
{
quadruple
}
it. E.g.
\
to extract
\LaTeX\
\samp
{
\e
section
\{
{
\rm
\ldots
}
\}
}
headers from a document, you can use this pattern:
\code
{
'
\e
\e
\e\e
section
\{\e
(.*
\e
)
\}
'
}
.
...
...
@@ -84,7 +84,7 @@ expressions.)
\begin{funcdesc}
{
symcomp
}{
pattern
\optional
{
\,
translate
}}
This is like
\code
{
compile
}
, but supports symbolic group names: if a
parenthes
e
s-enclosed group begins with a group name in angular
parenthes
i
s-enclosed group begins with a group name in angular
brackets, e.g.
\code
{
'
\e
(<id>[a-z][a-z0-9]*
\e
)'
}
, the group can
be referenced by its name in arguments to the
\code
{
group
}
method of
the resulting compiled regular expression object, like this:
...
...
Doc/lib/librfc822.tex
View file @
6c4f0032
...
...
@@ -29,7 +29,7 @@ object is seekable.
\end{funcdesc}
\begin{funcdesc}
{
getallmatchingheaders
}{
name
}
Return a list of lines consisting of all headers
whose header matches
Return a list of lines consisting of all headers
matching
\var
{
name
}
, if any. Each physical line, whether it is a continuation
line or not, is a separate list item. Return the empty list if no
header matches
\var
{
name
}
.
...
...
@@ -60,12 +60,12 @@ returned by \code{getheader(\var{name})}. If no header matching
\var
{
name
}
exists, return
\code
{
None, None
}
; otherwise both the full
name and the address are (possibly empty )strings.
Example:
i
f
\code
{
m
}
's first
\code
{
From
}
header contains the string
Example:
I
f
\code
{
m
}
's first
\code
{
From
}
header contains the string
\code
{
'guido@cwi.nl (Guido van Rossum)'
}
, then
\code
{
m.getaddr('From')
}
will yield the pair
\code
{
('Guido van Rossum', 'guido
\
@
cwi.nl')
}
.
\code
{
('Guido van Rossum', 'guido@cwi.nl')
}
.
If the header contained
\code
{
'Guido van Rossum <guido
\
@
cwi.nl>'
}
instead, it would yield the
\code
{
'Guido van Rossum <guido@cwi.nl>'
}
instead, it would yield the
exact same result.
\end{funcdesc}
...
...
@@ -82,7 +82,7 @@ yields bogus results if a full name contains a comma.
\begin{funcdesc}
{
getdate
}{
name
}
Retrieve a header using
\code
{
getheader
}
and parse it into a 9-tuple
compatible with
\code
{
time.
km
time()
}
. If there is no header matching
compatible with
\code
{
time.
mk
time()
}
. If there is no header matching
\var
{
name
}
, or it is unparsable, return
\code
{
None
}
.
Date parsing appears to be a black art, and not all mailers adhere to
...
...
Doc/lib/libsgmllib.tex
View file @
6c4f0032
...
...
@@ -7,7 +7,7 @@
This module defines a class
\code
{
SGMLParser
}
which serves as the
basis for parsing text files formatted in SGML (Standard Generalized
Mark-up Language). In fact, it does not provide a full SGML parser
--- it only parses SGML insofar as it is used by HTML, and module only
--- it only parses SGML insofar as it is used by HTML, and
the
module only
exists as a basis for the
\code
{
htmllib
}
module.
\stmodindex
{
htmllib
}
...
...
@@ -77,8 +77,8 @@ This method is called to process an entity reference of the form
``
\code
{
\&\var
{
ref
}
;
}
'' where
\var
{
ref
}
is an alphabetic entity
reference. It looks for
\var
{
ref
}
in the instance (or class)
variable
\code
{
entitydefs
}
which should give the entity's translation.
If a translation is found, it calls
e
the method
\code
{
handle
_
data()
}
with the translation; otherwise, it calls
e
the method
If a translation is found, it calls the method
\code
{
handle
_
data()
}
with the translation; otherwise, it calls the method
\code
{
unknown
_
entityref(
\var
{
ref
}
)
}
.
\end{funcdesc}
...
...
@@ -142,7 +142,7 @@ This method is called to process a closing tag \var{tag}.
Note that the parser maintains a stack of opening tags for which no
matching closing tag has been found yet. Only tags processed by
\code
{
start
_
\var
{
tag
}
()
}
are pushed on this stack. Definition
i
f a
\code
{
start
_
\var
{
tag
}
()
}
are pushed on this stack. Definition
o
f a
\code
{
end
_
\var
{
tag
}
()
}
method is optional for these tags. For tags
processed by
\code
{
do
_
\var
{
tag
}
()
}
or by
\code
{
unknown
_
tag()
}
, no
\code
{
end
_
\var
{
tag
}
()
}
method must be defined.
Doc/lib/libstruct.tex
View file @
6c4f0032
...
...
@@ -49,7 +49,7 @@ and Python values should be obvious given their types:
\lineiii
{
d
}{
double
}{
float
}
\end{tableiii}
A format character may be preceded by an integral repeat count; e.g.
A format character may be preceded by an integral repeat count; e.g.
\
the format string
\code
{
'4h'
}
means exactly the same as
\code
{
'hhhh'
}
.
C numbers are represented in the machine's native format and byte
...
...
@@ -66,10 +66,10 @@ calcsize('hhl') == 8
Hint: to align the end of a structure to the alignment requirement of
a particular type, end the format with the code for that type with a
repeat count of zero, e.g. the format
\code
{
'llh0l'
}
specifies two
repeat count of zero, e.g.
\
the format
\code
{
'llh0l'
}
specifies two
pad bytes at the end, assuming longs are aligned on 4-byte boundaries.
(More format characters are planned, e.g.
\code
{
's'
}
for character
(More format characters are planned, e.g.
\
\code
{
's'
}
for character
arrays, upper case for unsigned variants, and a way to specify the
byte order, which is useful for [de]constructing network packets and
reading/writing portable binary file formats like TIFF and AIFF.)
Doc/lib/libsys.tex
View file @
6c4f0032
...
...
@@ -88,7 +88,7 @@ determines how often the interpreter checks for periodic things such
as thread switches and signal handlers. The default is 10, meaning
the check is performed every 10 Python virtual instructions. Setting
it to a larger value may increase performance for programs using
threads. Setting it to a value
<= 0
checks every virtual instruction,
threads. Setting it to a value
$
\leq
0
$
checks every virtual instruction,
maximizing responsiveness as well as overhead.
\end{funcdesc}
...
...
Doc/lib/libtime.tex
View file @
6c4f0032
...
...
@@ -30,7 +30,7 @@ in this respect.
\item
The precision of the various real-time functions may be less than
suggested by the units in which their value or argument is expressed.
E.g. on most UNIX systems, the clock ``ticks'' only every 1/50th or
E.g.
\
on most UNIX systems, the clock ``ticks'' only every 1/50th or
1/100th of a second, and on the Mac, it ticks 60 times a second.
\end{itemize}
...
...
@@ -73,9 +73,9 @@ Nonzero if a DST timezone is defined.
\begin{funcdesc}
{
gmtime
}{
secs
}
Convert a time expressed in seconds since the epoch to a tuple of 9
integers, in UTC: year (e.g.
1993), month (1-12), day (1
-31), hour
(0-
23), minute (0-59), second (0-59), weekday (0
-6, monday is 0),
julian day (1
-366), dst flag (always zero). Fractions of a second are
integers, in UTC: year (e.g.
\
1993), month (1--12), day (1-
-31), hour
(0-
-23), minute (0--59), second (0--59), weekday (0-
-6, monday is 0),
Julian day (1-
-366), dst flag (always zero). Fractions of a second are
ignored. Note subtle differences with the C function of this name.
\end{funcdesc}
...
...
Doc/lib/liburllib.tex
View file @
6c4f0032
...
...
@@ -37,7 +37,7 @@ protocol that uses this is HTTP). See the description of the
\begin{funcdesc}
{
urlretrieve
}{
url
}
Copy a network object denoted by a URL to a local file, if necessary.
If the URL points to a local file, or a valid cached copy of the
the
If the URL points to a local file, or a valid cached copy of the
object exists, the object is not copied. Return a tuple (
\var
{
filename
}
,
\var
{
headers
}
) where
\var
{
filename
}
is the local file name under which
the object can be found, and
\var
{
headers
}
is either
\code
{
None
}
(for
...
...
@@ -61,7 +61,7 @@ Example: \code{quote('/\~conolly/')} yields \code{'/\%7econnolly/'}.
\end{funcdesc}
\begin{funcdesc}
{
unquote
}{
string
}
Re
move
\code
{
\%
xx
}
escapes by their single-character equivalent.
Re
place
\samp
{
\%
xx
}
escapes by their single-character equivalent.
Example:
\code
{
unquote('/
\%
7Econnolly/')
}
yields
\code
{
'/
\~
connolly/'
}
.
\end{funcdesc}
...
...
@@ -82,7 +82,7 @@ The caching feature of \code{urlretrieve()} has been disabled until I
find the time to hack proper processing of Expiration time headers.
\item
There should be a
n
function to query whether a particular URL is in
There should be a function to query whether a particular URL is in
the cache.
\item
...
...
Doc/libarray.tex
View file @
6c4f0032
...
...
@@ -63,8 +63,8 @@ available are still inserted into the array.
\end{funcdesc}
\begin{funcdesc}
{
fromlist
}{
list
}
Append
s
items from the list. This is equivalent to
\code
{
for x in
\var
{
list
}
: a.append(x)
}
Append items from the list. This is equivalent to
\code
{
for x in
\var
{
list
}
:
\
a.append(x)
}
except that if there is a type error, the array is unchanged.
\end{funcdesc}
...
...
Doc/libcgi.tex
View file @
6c4f0032
...
...
@@ -62,7 +62,9 @@ most once per script invocation, as it may consume standard input (if
the form was submitted through a POST request). The keys in the
resulting dictionary are the field names used in the submission; the
values are
{
\em
lists
}
of the field values (since field name may be
used multiple times in a single form). As a side effect, it sets
used multiple times in a single form).
\samp
{
\%
}
escapes in the
values are translated to their single-character equivalent using
\code
{
urllib.unquote()
}
. As a side effect, this function sets
\code
{
environ['QUERY
_
STRING']
}
to the raw query string, if it isn't
already set.
\end{funcdesc}
...
...
@@ -79,7 +81,9 @@ environment. This is mainly useful when debugging a CGI script.
\end{funcdesc}
\begin{funcdesc}
{
print
_
form
}{
form
}
Print a piece of HTML text showing the contents of the
\var
{
form
}
.
Print a piece of HTML text showing the contents of the
\var
{
form
}
(a
dictionary, an instance of the
\code
{
FormContentDict
}
class defined
below, or a subclass thereof).
This is mainly useful when debugging a CGI script.
\end{funcdesc}
...
...
Doc/libfuncs.tex
View file @
6c4f0032
...
...
@@ -42,7 +42,7 @@ exactly one argument.)
\begin{funcdesc}
{
compile
}{
string
\,
filename
\,
kind
}
Compile the
\var
{
string
}
into a code object. Code objects can be
executed by a
\code
{
exec()
}
statement or evaluated by a call to
executed by a
n
\code
{
exec
}
statement or evaluated by a call to
\code
{
eval()
}
. The
\var
{
filename
}
argument should
give the file from which the code was read; pass e.g.
\code
{
'<string>'
}
if it wasn't read from a file. The
\var
{
kind
}
argument specifies
...
...
@@ -56,7 +56,7 @@ exactly one argument.)
object and a string. The string must be the name
of one of the object's attributes. The function deletes
the named attribute, provided the object allows it. For example,
\code
{
set
attr(
\var
{
x
}
, '
\var
{
foobar
}
')
}
is equivalent to
\code
{
del
attr(
\var
{
x
}
, '
\var
{
foobar
}
')
}
is equivalent to
\code
{
del
\var
{
x
}
.
\var
{
foobar
}}
.
\end{funcdesc}
...
...
@@ -106,13 +106,15 @@ exactly one argument.)
\end{verbatim}
\ecode
This function can also be used to execute arbitrary code objects
(e.g. created by
\code
{
compile()
}
). In this case pass a code
(e.g.
\
created by
\code
{
compile()
}
). In this case pass a code
object instead of a string. The code object must have been compiled
passing
\code
{
'eval'
}
to the
\var
{
kind
}
argument.
Note
: dynamic execution of statements is supported by the
Hints
: dynamic execution of statements is supported by the
\code
{
exec
}
statement. Execution of statements from a file is
supported by the
\code
{
execfile()
}
function.
supported by the
\code
{
execfile()
}
function. The
\code
{
vars()
}
function returns the current local dictionary, which may be useful
to pass around for use by
\code
{
eval()
}
or
\code
{
execfile()
}
.
\end{funcdesc}
...
...
@@ -138,7 +140,7 @@ Construct a list from those elements of \var{list} for which
\var
{
function
}
returns true. If
\var
{
list
}
is a string or a tuple,
the result also has that type; otherwise it is always a list. If
\var
{
function
}
is
\code
{
None
}
, the identity function is assumed,
i.e. all elements of
\var
{
list
}
that are false (zero or empty) are
i.e.
\
all elements of
\var
{
list
}
that are false (zero or empty) are
removed.
\end{funcdesc}
...
...
@@ -268,7 +270,7 @@ there's no reliable way to determine whether this is the case.}
\begin{funcdesc}
{
pow
}{
x
\,
y
\optional
{
\,
z
}}
Return
\var
{
x
}
to the power
\var
{
y
}
; if
\var
{
z
}
is present, return
\var
{
x
}
to the power
\var
{
y
}
, modulo
\var
{
z
}
(computed more
efficiently tha
t
\code
{
pow(
\var
{
x
}
,
\var
{
y
}
)
\%
\var
{
z
}}
).
efficiently tha
n
\code
{
pow(
\var
{
x
}
,
\var
{
y
}
)
\%
\var
{
z
}}
).
The arguments must have
numeric types. With mixed operand types, the rules for binary
arithmetic operators apply. The effective operand type is also the
...
...
@@ -378,7 +380,7 @@ when passed to \code{eval()}.
\begin{funcdesc}
{
str
}{
object
}
Return a string containing a nicely printable representation of an
object. For strings, this returns the string itself. The difference
with
\code
{
repr(
\var
{
object
}
}
is that
\code
{
str(
\var
{
object
}
}
does not
with
\code
{
repr(
\var
{
object
}
)
}
is that
\code
{
str(
\var
{
object
}
)
}
does not
always attempt to return a string that is acceptable to
\code
{
eval()
}
;
its goal is to return a printable string.
\end{funcdesc}
...
...
@@ -412,7 +414,7 @@ The returned dictionary should not be modified: the effects on the
corresponding symbol table are undefined.
%
\footnote
{
In the current implementation, local variable bindings
cannot normally be affected this way, but variables retrieved from
other scopes can be. This may change.
}
other scopes
(e.g. modules)
can be. This may change.
}
\end{funcdesc}
\begin{funcdesc}
{
xrange
}{
\optional
{
start
\,
}
end
\optional
{
\,
step
}}
...
...
Doc/libhttplib.tex
View file @
6c4f0032
...
...
@@ -6,7 +6,7 @@
This module defines a class which implements the client side of the
HTTP protocol. It is normally not used directly --- the module
\code
{
urll
lib
}
module
uses it to handle URLs that use HTTP.
\code
{
urll
ib
}
uses it to handle URLs that use HTTP.
\stmodindex
{
urllib
}
The module defines one class,
\code
{
HTTP
}
. An
\code
{
HTTP
}
instance
...
...
@@ -80,7 +80,7 @@ Send a blank line to the server, signalling the end of the headers.
Complete the request by shutting down the sending end of the socket,
read the reply from the server, and return a triple (
\var
{
replycode
}
,
\var
{
message
}
,
\var
{
headers
}
). Here
\var
{
replycode
}
is the integer
reply code from the request (e.g.
\code
{
200
}
if the request was
reply code from the request (e.g.
\
\code
{
200
}
if the request was
handled properly);
\var
{
message
}
is the message string corresponding
to the reply code; and
\var
{
header
}
is an instance of the class
\code
{
rfc822.Message
}
containing the headers received from the server.
...
...
Doc/libimp.tex
View file @
6c4f0032
...
...
@@ -2,7 +2,7 @@
\bimodindex
{
imp
}
\index
{
import
}
This module provides an interface to the mechanisms use to implement
This module provides an interface to the mechanisms use
d
to implement
the
\code
{
import
}
statement. It defines the following constants and
functions:
...
...
Doc/libpdb.tex
View file @
6c4f0032
...
...
@@ -99,7 +99,7 @@ either ``\code{h}'' or ``\code{help}'' can be used to enter the help
command (but not ``
\code
{
he
}
'' or ``
\code
{
hel
}
'', nor ``
\code
{
H
}
'' or
``
\code
{
Help
}
or ``
\code
{
HELP
}
''). Arguments to commands must be
separated by whitespace (spaces or tabs). Optional arguments are
enclosed in square brackets (``
\code
{
[]
}
'')in the command syntax; the
enclosed in square brackets (``
\code
{
[]
}
'')
in the command syntax; the
square brackets must not be typed. Alternatives in the command syntax
are separated by a vertical bar (``
\code
{
|
}
'').
...
...
Doc/libprofile.tex
View file @
6c4f0032
...
...
@@ -6,7 +6,7 @@ Copyright 1994, by InfoSeek Corporation, all rights reserved.
Written by James Roskind
%
\footnote
{
Updated and converted to
LaTeX
by Guido van Rossum. The references to
Updated and converted to
\LaTeX\
by Guido van Rossum. The references to
the old profiler are left in the text, although it no longer exists.
}
...
...
Doc/libregex.tex
View file @
6c4f0032
...
...
@@ -19,7 +19,7 @@ is because Python doesn't remove backslashes from string literals if
they are followed by an unrecognized escape character.
\emph
{
However
}
, if you want to include a literal
\dfn
{
backslash
}
in a
regular expression represented as a string literal, you have to
\emph
{
quadruple
}
it. E.g.
to extract LaTeX
\samp
{
\e
section
\{
{
\rm
\emph
{
quadruple
}
it. E.g.
\
to extract
\LaTeX\
\samp
{
\e
section
\{
{
\rm
\ldots
}
\}
}
headers from a document, you can use this pattern:
\code
{
'
\e
\e
\e\e
section
\{\e
(.*
\e
)
\}
'
}
.
...
...
@@ -84,7 +84,7 @@ expressions.)
\begin{funcdesc}
{
symcomp
}{
pattern
\optional
{
\,
translate
}}
This is like
\code
{
compile
}
, but supports symbolic group names: if a
parenthes
e
s-enclosed group begins with a group name in angular
parenthes
i
s-enclosed group begins with a group name in angular
brackets, e.g.
\code
{
'
\e
(<id>[a-z][a-z0-9]*
\e
)'
}
, the group can
be referenced by its name in arguments to the
\code
{
group
}
method of
the resulting compiled regular expression object, like this:
...
...
Doc/librfc822.tex
View file @
6c4f0032
...
...
@@ -29,7 +29,7 @@ object is seekable.
\end{funcdesc}
\begin{funcdesc}
{
getallmatchingheaders
}{
name
}
Return a list of lines consisting of all headers
whose header matches
Return a list of lines consisting of all headers
matching
\var
{
name
}
, if any. Each physical line, whether it is a continuation
line or not, is a separate list item. Return the empty list if no
header matches
\var
{
name
}
.
...
...
@@ -60,12 +60,12 @@ returned by \code{getheader(\var{name})}. If no header matching
\var
{
name
}
exists, return
\code
{
None, None
}
; otherwise both the full
name and the address are (possibly empty )strings.
Example:
i
f
\code
{
m
}
's first
\code
{
From
}
header contains the string
Example:
I
f
\code
{
m
}
's first
\code
{
From
}
header contains the string
\code
{
'guido@cwi.nl (Guido van Rossum)'
}
, then
\code
{
m.getaddr('From')
}
will yield the pair
\code
{
('Guido van Rossum', 'guido
\
@
cwi.nl')
}
.
\code
{
('Guido van Rossum', 'guido@cwi.nl')
}
.
If the header contained
\code
{
'Guido van Rossum <guido
\
@
cwi.nl>'
}
instead, it would yield the
\code
{
'Guido van Rossum <guido@cwi.nl>'
}
instead, it would yield the
exact same result.
\end{funcdesc}
...
...
@@ -82,7 +82,7 @@ yields bogus results if a full name contains a comma.
\begin{funcdesc}
{
getdate
}{
name
}
Retrieve a header using
\code
{
getheader
}
and parse it into a 9-tuple
compatible with
\code
{
time.
km
time()
}
. If there is no header matching
compatible with
\code
{
time.
mk
time()
}
. If there is no header matching
\var
{
name
}
, or it is unparsable, return
\code
{
None
}
.
Date parsing appears to be a black art, and not all mailers adhere to
...
...
Doc/libsgmllib.tex
View file @
6c4f0032
...
...
@@ -7,7 +7,7 @@
This module defines a class
\code
{
SGMLParser
}
which serves as the
basis for parsing text files formatted in SGML (Standard Generalized
Mark-up Language). In fact, it does not provide a full SGML parser
--- it only parses SGML insofar as it is used by HTML, and module only
--- it only parses SGML insofar as it is used by HTML, and
the
module only
exists as a basis for the
\code
{
htmllib
}
module.
\stmodindex
{
htmllib
}
...
...
@@ -77,8 +77,8 @@ This method is called to process an entity reference of the form
``
\code
{
\&\var
{
ref
}
;
}
'' where
\var
{
ref
}
is an alphabetic entity
reference. It looks for
\var
{
ref
}
in the instance (or class)
variable
\code
{
entitydefs
}
which should give the entity's translation.
If a translation is found, it calls
e
the method
\code
{
handle
_
data()
}
with the translation; otherwise, it calls
e
the method
If a translation is found, it calls the method
\code
{
handle
_
data()
}
with the translation; otherwise, it calls the method
\code
{
unknown
_
entityref(
\var
{
ref
}
)
}
.
\end{funcdesc}
...
...
@@ -142,7 +142,7 @@ This method is called to process a closing tag \var{tag}.
Note that the parser maintains a stack of opening tags for which no
matching closing tag has been found yet. Only tags processed by
\code
{
start
_
\var
{
tag
}
()
}
are pushed on this stack. Definition
i
f a
\code
{
start
_
\var
{
tag
}
()
}
are pushed on this stack. Definition
o
f a
\code
{
end
_
\var
{
tag
}
()
}
method is optional for these tags. For tags
processed by
\code
{
do
_
\var
{
tag
}
()
}
or by
\code
{
unknown
_
tag()
}
, no
\code
{
end
_
\var
{
tag
}
()
}
method must be defined.
Doc/libstruct.tex
View file @
6c4f0032
...
...
@@ -49,7 +49,7 @@ and Python values should be obvious given their types:
\lineiii
{
d
}{
double
}{
float
}
\end{tableiii}
A format character may be preceded by an integral repeat count; e.g.
A format character may be preceded by an integral repeat count; e.g.
\
the format string
\code
{
'4h'
}
means exactly the same as
\code
{
'hhhh'
}
.
C numbers are represented in the machine's native format and byte
...
...
@@ -66,10 +66,10 @@ calcsize('hhl') == 8
Hint: to align the end of a structure to the alignment requirement of
a particular type, end the format with the code for that type with a
repeat count of zero, e.g. the format
\code
{
'llh0l'
}
specifies two
repeat count of zero, e.g.
\
the format
\code
{
'llh0l'
}
specifies two
pad bytes at the end, assuming longs are aligned on 4-byte boundaries.
(More format characters are planned, e.g.
\code
{
's'
}
for character
(More format characters are planned, e.g.
\
\code
{
's'
}
for character
arrays, upper case for unsigned variants, and a way to specify the
byte order, which is useful for [de]constructing network packets and
reading/writing portable binary file formats like TIFF and AIFF.)
Doc/libsys.tex
View file @
6c4f0032
...
...
@@ -88,7 +88,7 @@ determines how often the interpreter checks for periodic things such
as thread switches and signal handlers. The default is 10, meaning
the check is performed every 10 Python virtual instructions. Setting
it to a larger value may increase performance for programs using
threads. Setting it to a value
<= 0
checks every virtual instruction,
threads. Setting it to a value
$
\leq
0
$
checks every virtual instruction,
maximizing responsiveness as well as overhead.
\end{funcdesc}
...
...
Doc/libtime.tex
View file @
6c4f0032
...
...
@@ -30,7 +30,7 @@ in this respect.
\item
The precision of the various real-time functions may be less than
suggested by the units in which their value or argument is expressed.
E.g. on most UNIX systems, the clock ``ticks'' only every 1/50th or
E.g.
\
on most UNIX systems, the clock ``ticks'' only every 1/50th or
1/100th of a second, and on the Mac, it ticks 60 times a second.
\end{itemize}
...
...
@@ -73,9 +73,9 @@ Nonzero if a DST timezone is defined.
\begin{funcdesc}
{
gmtime
}{
secs
}
Convert a time expressed in seconds since the epoch to a tuple of 9
integers, in UTC: year (e.g.
1993), month (1-12), day (1
-31), hour
(0-
23), minute (0-59), second (0-59), weekday (0
-6, monday is 0),
julian day (1
-366), dst flag (always zero). Fractions of a second are
integers, in UTC: year (e.g.
\
1993), month (1--12), day (1-
-31), hour
(0-
-23), minute (0--59), second (0--59), weekday (0-
-6, monday is 0),
Julian day (1-
-366), dst flag (always zero). Fractions of a second are
ignored. Note subtle differences with the C function of this name.
\end{funcdesc}
...
...
Doc/liburllib.tex
View file @
6c4f0032
...
...
@@ -37,7 +37,7 @@ protocol that uses this is HTTP). See the description of the
\begin{funcdesc}
{
urlretrieve
}{
url
}
Copy a network object denoted by a URL to a local file, if necessary.
If the URL points to a local file, or a valid cached copy of the
the
If the URL points to a local file, or a valid cached copy of the
object exists, the object is not copied. Return a tuple (
\var
{
filename
}
,
\var
{
headers
}
) where
\var
{
filename
}
is the local file name under which
the object can be found, and
\var
{
headers
}
is either
\code
{
None
}
(for
...
...
@@ -61,7 +61,7 @@ Example: \code{quote('/\~conolly/')} yields \code{'/\%7econnolly/'}.
\end{funcdesc}
\begin{funcdesc}
{
unquote
}{
string
}
Re
move
\code
{
\%
xx
}
escapes by their single-character equivalent.
Re
place
\samp
{
\%
xx
}
escapes by their single-character equivalent.
Example:
\code
{
unquote('/
\%
7Econnolly/')
}
yields
\code
{
'/
\~
connolly/'
}
.
\end{funcdesc}
...
...
@@ -82,7 +82,7 @@ The caching feature of \code{urlretrieve()} has been disabled until I
find the time to hack proper processing of Expiration time headers.
\item
There should be a
n
function to query whether a particular URL is in
There should be a function to query whether a particular URL is in
the cache.
\item
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment