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
4856d017
Commit
4856d017
authored
Jan 12, 1999
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed a lot of unnecessary comment markers which cause unexplained
numbers to appear in the HTML version of the manual.
parent
8e2c9457
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
84 deletions
+83
-84
Doc/ref/ref3.tex
Doc/ref/ref3.tex
+83
-84
No files found.
Doc/ref/ref3.tex
View file @
4856d017
...
...
@@ -49,7 +49,7 @@ references.)
Note that the use of the implementation's tracing or debugging
facilities may keep objects alive that would normally be collectable.
Also note that catching an exception with a
`
\
code
{
try
}
...
\code
{
except
}
' statement may keep objects alive.
`
\
keyword
{
try
}
...
\keyword
{
except
}
' statement may keep objects alive.
Some objects contain references to ``external'' resources such as open
files or windows. It is understood that these resources are freed
...
...
@@ -57,9 +57,8 @@ when the object is garbage-collected, but since garbage collection is
not guaranteed to happen, such objects also provide an explicit way to
release the external resource, usually a
\method
{
close()
}
method.
Programs are strongly recommended to explicitly close such
objects.
The `
\code
{
try
}
...
\code
{
finally
}
' statement provides a convenient way
to do this.
objects. The `
\keyword
{
try
}
...
\keyword
{
finally
}
' statement provides
a convenient way to do this.
Some objects contain references to other objects; these are called
\emph
{
containers
}
. Examples of containers are tuples, lists and
...
...
@@ -110,7 +109,7 @@ object, if it has any.
\index
{
attribute
}
\indexii
{
special
}{
attribute
}
\indexiii
{
generic
}{
special
}{
attribute
}
\withsubitem
{
(built-in object attribute)
}{
%
\withsubitem
{
(built-in object attribute)
}{
\ttindex
{__
methods
__}
\ttindex
{__
members
__}}
...
...
@@ -231,7 +230,7 @@ renumbered so that it starts at 0.
Sequences are distinguished according to their mutability:
\begin{description}
%
\item
[Immutable sequences]
An object of an immutable sequence type cannot change once it is
created. (If the object contains references to other objects,
...
...
@@ -388,12 +387,12 @@ defines the global namespace of the module in which the function was
defined. Additional information about a function's definition can be
retrieved from its code object; see the description of internal types
below.
\withsubitem
{
(function attribute)
}{
%
\ttindex
{
func
_
doc
}
%
\ttindex
{__
doc
__}
%
\ttindex
{__
name
__}
%
\ttindex
{
func
_
defaults
}
%
\ttindex
{
func
_
code
}
%
\withsubitem
{
(function attribute)
}{
\ttindex
{
func
_
doc
}
\ttindex
{__
doc
__}
\ttindex
{__
name
__}
\ttindex
{
func
_
defaults
}
\ttindex
{
func
_
code
}
\ttindex
{
func
_
globals
}}
\indexii
{
global
}{
namespace
}
...
...
@@ -411,8 +410,8 @@ base class of the class of which \member{im_self} is an instance);
\member
{__
doc
__}
is the method's documentation (same as
\code
{
im
_
func.
__
doc
__}
);
\member
{__
name
__}
is the method name (same as
\code
{
im
_
func.
__
name
__}
).
\withsubitem
{
(method attribute)
}{
%
\ttindex
{
im
_
func
}
%
\withsubitem
{
(method attribute)
}{
\ttindex
{
im
_
func
}
\ttindex
{
im
_
self
}}
User-defined method objects are created in two ways: when getting an
...
...
@@ -430,9 +429,9 @@ function \method{f()}, \code{C.f} does not yield the function object
instance,
\code
{
x.f
}
yields a bound method object
\code
{
m
}
where
\code
{
m.im
_
class
}
is
\code
{
C
}
,
\code
{
m.im
_
func
}
is
\method
{
f()
}
, and
\code
{
m.im
_
self
}
is
\code
{
x
}
.
\withsubitem
{
(method attribute)
}{
%
\ttindex
{
im
_
class
}
%
\ttindex
{
im
_
func
}
%
\withsubitem
{
(method attribute)
}{
\ttindex
{
im
_
class
}
\ttindex
{
im
_
func
}
\ttindex
{
im
_
self
}}
When an unbound user-defined method object is called, the underlying
...
...
@@ -531,9 +530,9 @@ The \member{__file__} attribute is not present for C{} modules that are
statically linked into the interpreter; for extension modules loaded
dynamically from a shared library, it is the pathname of the shared
library file.
\withsubitem
{
(module attribute)
}{
%
\ttindex
{__
name
__}
%
\ttindex
{__
doc
__}
%
\withsubitem
{
(module attribute)
}{
\ttindex
{__
name
__}
\ttindex
{__
doc
__}
\ttindex
{__
file
__}}
\indexii
{
module
}{
namespace
}
...
...
@@ -576,11 +575,11 @@ Special attributes: \member{__name__} is the class name;
containing the base classes, in the order of their occurrence in the
base class list;
\member
{__
doc
__}
is the class's documentation string,
or None if undefined.
\withsubitem
{
(class attribute)
}{
%
\ttindex
{__
name
__}
%
\ttindex
{__
module
__}
%
\ttindex
{__
dict
__}
%
\ttindex
{__
bases
__}
%
\withsubitem
{
(class attribute)
}{
\ttindex
{__
name
__}
\ttindex
{__
module
__}
\ttindex
{__
dict
__}
\ttindex
{__
bases
__}
\ttindex
{__
doc
__}}
\item
[Class instances]
...
...
@@ -617,8 +616,8 @@ section \ref{specialnames}, ``Special method names.''
Special attributes:
\member
{__
dict
__}
is the attribute
dictionary;
\member
{__
class
__}
is the instance's class.
\withsubitem
{
(instance attribute)
}{
%
\ttindex
{__
dict
__}
%
\withsubitem
{
(instance attribute)
}{
\ttindex
{__
dict
__}
\ttindex
{__
class
__}}
\item
[Files]
...
...
@@ -637,9 +636,9 @@ Library Reference} for complete documentation of file objects.
\bifuncindex
{
open
}
\withsubitem
{
(in module os)
}{
\ttindex
{
popen()
}}
\withsubitem
{
(socket method)
}{
\ttindex
{
makefile()
}}
\withsubitem
{
(in module sys)
}{
%
\ttindex
{
stdin
}
%
\ttindex
{
stdout
}
%
\withsubitem
{
(in module sys)
}{
\ttindex
{
stdin
}
\ttindex
{
stdout
}
\ttindex
{
stderr
}}
\ttindex
{
sys.stdin
}
\ttindex
{
sys.stdout
}
...
...
@@ -684,18 +683,18 @@ byte code offsets to line numbers (for detais see the source code of
the interpreter);
\member
{
co
_
stacksize
}
is the required stack size
(including local variables);
\member
{
co
_
flags
}
is an integer encoding
a number of flags for the interpreter.
\withsubitem
{
(code object attribute)
}{
%
\ttindex
{
co
_
argcount
}
%
\ttindex
{
co
_
code
}
%
\ttindex
{
co
_
consts
}
%
\ttindex
{
co
_
filename
}
%
\ttindex
{
co
_
firstlineno
}
%
\ttindex
{
co
_
flags
}
%
\ttindex
{
co
_
lnotab
}
%
\ttindex
{
co
_
name
}
%
\ttindex
{
co
_
names
}
%
\ttindex
{
co
_
nlocals
}
%
\ttindex
{
co
_
stacksize
}
%
\withsubitem
{
(code object attribute)
}{
\ttindex
{
co
_
argcount
}
\ttindex
{
co
_
code
}
\ttindex
{
co
_
consts
}
\ttindex
{
co
_
filename
}
\ttindex
{
co
_
firstlineno
}
\ttindex
{
co
_
flags
}
\ttindex
{
co
_
lnotab
}
\ttindex
{
co
_
name
}
\ttindex
{
co
_
names
}
\ttindex
{
co
_
nlocals
}
\ttindex
{
co
_
stacksize
}
\ttindex
{
co
_
varnames
}}
The following flag bits are defined for
\member
{
co
_
flags
}
: bit 2 is set
...
...
@@ -724,14 +723,14 @@ executing in restricted execution mode;
\member
{
f
_
lineno
}
gives the line number and
\member
{
f
_
lasti
}
gives the
precise instruction (this is an index into the bytecode string of
the code object).
\withsubitem
{
(frame attribute)
}{
%
\ttindex
{
f
_
back
}
%
\ttindex
{
f
_
code
}
%
\ttindex
{
f
_
globals
}
%
\ttindex
{
f
_
locals
}
%
\ttindex
{
f
_
lineno
}
%
\ttindex
{
f
_
lasti
}
%
\ttindex
{
f
_
builtins
}
%
\withsubitem
{
(frame attribute)
}{
\ttindex
{
f
_
back
}
\ttindex
{
f
_
code
}
\ttindex
{
f
_
globals
}
\ttindex
{
f
_
locals
}
\ttindex
{
f
_
lineno
}
\ttindex
{
f
_
lasti
}
\ttindex
{
f
_
builtins
}
\ttindex
{
f
_
restricted
}}
Special writable attributes:
\member
{
f
_
trace
}
, if not
\code
{
None
}
, is a
...
...
@@ -739,10 +738,10 @@ function called at the start of each source code line (this is used by
the debugger);
\member
{
f
_
exc
_
type
}
,
\member
{
f
_
exc
_
value
}
,
\member
{
f
_
exc
_
traceback
}
represent the most recent exception caught in
this frame.
\withsubitem
{
(frame attribute)
}{
%
\ttindex
{
f
_
trace
}
%
\ttindex
{
f
_
exc
_
type
}
%
\ttindex
{
f
_
exc
_
value
}
%
\withsubitem
{
(frame attribute)
}{
\ttindex
{
f
_
trace
}
\ttindex
{
f
_
exc
_
type
}
\ttindex
{
f
_
exc
_
value
}
\ttindex
{
f
_
exc
_
traceback
}}
\item
[Traceback objects]
\label
{
traceback
}
...
...
@@ -765,9 +764,9 @@ interactive, it is also made available to the user as
\indexii
{
stack
}{
trace
}
\indexii
{
exception
}{
handler
}
\indexii
{
execution
}{
stack
}
\withsubitem
{
(in module sys)
}{
%
\ttindex
{
exc
_
info
}
%
\ttindex
{
exc
_
traceback
}
%
\withsubitem
{
(in module sys)
}{
\ttindex
{
exc
_
info
}
\ttindex
{
exc
_
traceback
}
\ttindex
{
last
_
traceback
}}
\ttindex
{
sys.exc
_
info
}
\ttindex
{
sys.exc
_
traceback
}
...
...
@@ -782,10 +781,10 @@ precise instruction. The line number and last instruction in the
traceback may differ from the line number of its frame object if the
exception occurred in a
\keyword
{
try
}
statement with no matching
except clause or with a finally clause.
\withsubitem
{
(traceback attribute)
}{
%
\ttindex
{
tb
_
next
}
%
\ttindex
{
tb
_
frame
}
%
\ttindex
{
tb
_
lineno
}
%
\withsubitem
{
(traceback attribute)
}{
\ttindex
{
tb
_
next
}
\ttindex
{
tb
_
frame
}
\ttindex
{
tb
_
lineno
}
\ttindex
{
tb
_
lasti
}}
\stindex
{
try
}
...
...
@@ -799,9 +798,9 @@ k:l]}, or \code{a[..., i:j])}. They are also created by the built-in
Special read-only attributes:
\member
{
start
}
is the lowerbound;
\member
{
stop
}
is the upperbound;
\member
{
step
}
is the step value; each is
\code
{
None
}
if omitted. These attributes can have any type.
\withsubitem
{
(slice object attribute)
}{
%
\ttindex
{
start
}
%
\ttindex
{
stop
}
%
\withsubitem
{
(slice object attribute)
}{
\ttindex
{
start
}
\ttindex
{
stop
}
\ttindex
{
step
}}
\end{description}
% Internal types
...
...
@@ -1026,27 +1025,27 @@ multiplication (meaning repetition) by defining the methods
\method
{__
add
__
()
}
,
\method
{__
radd
__
()
}
,
\method
{__
mul
__
()
}
and
\method
{__
rmul
__
()
}
described below; they should not define
\method
{__
coerce
__
()
}
or other numerical operators.
\withsubitem
{
(mapping object method)
}{
%
\ttindex
{
keys()
}
%
\ttindex
{
values()
}
%
\ttindex
{
items()
}
%
\ttindex
{
has
_
key()
}
%
\ttindex
{
get()
}
%
\ttindex
{
clear()
}
%
\ttindex
{
copy()
}
%
\withsubitem
{
(mapping object method)
}{
\ttindex
{
keys()
}
\ttindex
{
values()
}
\ttindex
{
items()
}
\ttindex
{
has
_
key()
}
\ttindex
{
get()
}
\ttindex
{
clear()
}
\ttindex
{
copy()
}
\ttindex
{
update()
}}
\withsubitem
{
(sequence object method)
}{
%
\ttindex
{
append()
}
%
\ttindex
{
count()
}
%
\ttindex
{
index()
}
%
\ttindex
{
insert()
}
%
\ttindex
{
pop()
}
%
\ttindex
{
remove()
}
%
\ttindex
{
reverse()
}
%
\ttindex
{
sort()
}
%
\ttindex
{__
add
__
()
}
%
\ttindex
{__
radd
__
()
}
%
\ttindex
{__
mul
__
()
}
%
\withsubitem
{
(sequence object method)
}{
\ttindex
{
append()
}
\ttindex
{
count()
}
\ttindex
{
index()
}
\ttindex
{
insert()
}
\ttindex
{
pop()
}
\ttindex
{
remove()
}
\ttindex
{
reverse()
}
\ttindex
{
sort()
}
\ttindex
{__
add
__
()
}
\ttindex
{__
radd
__
()
}
\ttindex
{__
mul
__
()
}
\ttindex
{__
rmul
__
()
}}
\withsubitem
{
(numberic object method)
}{
\ttindex
{__
coerce
__
()
}}
...
...
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