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
9b0eaef5
Commit
9b0eaef5
authored
Apr 14, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some patches by Drew Csillag; plus a few of my own uncommitted changes.
parent
342f6dbc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
4 deletions
+98
-4
Doc/api.tex
Doc/api.tex
+49
-2
Doc/api/api.tex
Doc/api/api.tex
+49
-2
No files found.
Doc/api.tex
View file @
9b0eaef5
...
...
@@ -1073,7 +1073,7 @@ for which they do not apply, they will flag a Python exception.
Print an object
\var
{
o
}
, on file
\var
{
fp
}
. Returns
\code
{
-1
}
on error
The flags argument is used to enable certain printing
options. The only option currently supported is
\constant
{
Py
_
P
rint
_
RAW
}
.
\constant
{
Py
_
P
RINT
_
RAW
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyObject
_
HasAttrString
}{
PyObject *o, char *attr
_
name
}
...
...
@@ -1721,28 +1721,40 @@ This instance of \code{PyTypeObject} represents the Python string type.
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyString
_
Check
}{
PyObject *o
}
Returns true if the object
\var
{
o
}
is a string object.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
FromStringAndSize
}{
const char *v,
int len
}
Returns a new string object with the value
\var
{
v
}
and length
\var
{
len
}
on success, and
\NULL
{}
on failure. If
\var
{
v
}
is
\NULL
{}
,
the contents of the string are uninitialized.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
FromString
}{
const char *v
}
Returns a new string object with the value
\var
{
v
}
on success, and
\NULL
{}
on failure.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyString
_
Size
}{
PyObject *string
}
Returns the length of the string in string object
\var
{
string
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
char*
}{
PyString
_
AsString
}{
PyObject *string
}
Resturns a
\NULL
{}
terminated representation of the contents of
\var
{
string
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
void
}{
PyString
_
Concat
}{
PyObject **string,
PyObject *newpart
}
Creates a new string object in
\var
{
*string
}
containing the contents
of
\var
{
newpart
}
appended to
\var
{
string
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
void
}{
PyString
_
ConcatAndDel
}{
PyObject **string,
PyObject *newpart
}
Creates a new string object in
\var
{
*string
}
containing the contents
of
\var
{
newpart
}
appended to
\var
{
string
}
. --WHAT IS THE
DIFFERENCE BETWEEN THIS AND PLAIN CONCAT?--
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{_
PyString
_
Resize
}{
PyObject **string, int newsize
}
...
...
@@ -1852,27 +1864,42 @@ Returns true if its argument is a \code{PyListObject}.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
New
}{
int size
}
Returns a new list of length
\var
{
len
}
on success, and
\NULL
{}
on
failure.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Size
}{
PyObject *list
}
Returns the length of the list object in
\var
{
list
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
GetItem
}{
PyObject *list, int index
}
Returns the item in
\var
{
list
}
at index
\var
{
index
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
SetItem
}{
PyObject *list, int index,
PyObject *item
}
Sets the item at index
\var
{
index
}
in list to
\var
{
item
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Insert
}{
PyObject *list, int index,
PyObject *index
}
Inserts the item
\var
{
item
}
into list
\var
{
list
}
in front of index
\var
{
index
}
and returns true if successful.
For example:
\begin{verbatim}
PyList
_
Insert(list, 0, object);
\end{verbatim}
\end{cfuncdesc}
would insert
\var
{
object
}
at the front of the list.
\begin{cfuncdesc}
{
int
}{
PyList
_
Append
}{
PyObject *list, PyObject *item
}
Appends the object
\var
{
item
}
at the end of list
\var
{
list
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
GetSlice
}{
PyObject *list,
int low, int high
}
Returns a list of the objects in
\var
{
list
}
containing the objects
\emph
{
between
}
\var
{
low
}
and
\var
{
high
}
. Analogous to
\var
{
list[low:high]
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
SetSlice
}{
PyObject *list,
...
...
@@ -1881,12 +1908,14 @@ Returns true if its argument is a \code{PyListObject}.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Sort
}{
PyObject *list
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Reverse
}{
PyObject *list
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
AsTuple
}{
PyObject *list
}
Returns a new tuple object containing the contents of
\var
{
list
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
GET
_
ITEM
}{
PyObject *list, int i
}
...
...
@@ -2051,21 +2080,29 @@ Returns true if its argument is a \code{PyLongObject}.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromLong
}{
long v
}
Returns a new
\code
{
PyLong
}
object from
\var
{
v
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromUnsignedLong
}{
unsigned long v
}
Returns a new
\code
{
PyLong
}
object from an unsigned
\C
{}
long.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromDouble
}{
double v
}
Returns a new
\code
{
PyLong
}
object from the integer part of
\var
{
v
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
long
}{
PyLong
_
AsLong
}{
PyObject *pylong
}
Returns a
\C
{}
\code
{
long
}
representation of the contents of
\var
{
pylong
}
.
WHAT HAPPENS IF
\var
{
pylong
}
> MAXLONG?
\end{cfuncdesc}
\begin{cfuncdesc}
{
unsigned long
}{
PyLong
_
AsUnsignedLong
}{
PyObject *pylong
}
Returns a
\C
{}
\code
{
unsigned long
}
representation of the contents of
\var
{
pylong
}
. WHAT HAPPENS IF
\var
{
pylong
}
> MAXLONG?
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyLong
_
AsDouble
}{
PyObject *pylong
}
Returns a
\C
{}
\code
{
double
}
representation of teh contents of
\var
{
pylong
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromString
}{
char *str, char **pend,
...
...
@@ -2091,9 +2128,11 @@ Returns true if its argument is a \code{PyFloatObject}.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyFloat
_
FromDouble
}{
double v
}
Creates a
\code
{
PyFloat
}
object from
\var
{
v
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyFloat
_
AsDouble
}{
PyObject *pyfloat
}
Returns a
\C
{}
\code
{
double
}
representation of the contents of
\var
{
pyfloat
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyFloat
_
AS
_
DOUBLE
}{
PyObject *pyfloat
}
...
...
@@ -2153,12 +2192,15 @@ Returns true if its argument is a \code{PyComplexObject}.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyComplex
_
FromDoubles
}{
double real, double imag
}
Returns a new
\code
{
PyComplex
}
object from
\var
{
real
}
and
\var
{
imag
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyComplex
_
RealAsDouble
}{
PyObject *op
}
Returns the real part of
\var
{
op
}
as a
\C
{}
\code
{
double
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyComplex
_
ImagAsDouble
}{
PyObject *op
}
Returns the imaginary part of
\var
{
op
}
as a
\C
{}
\code
{
double
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
Py
_
complex
}{
PyComplex
_
AsCComplex
}{
PyObject *op
}
...
...
@@ -2854,6 +2896,11 @@ must be held.
\begin{cfuncdesc}
{
TYPE
}{_
PyObject
_
NEW
_
VAR
}{
TYPE, PyTypeObject *, int size
}
\end{cfuncdesc}
Py
_
InitModule (!!!)
PyArg
_
ParseTupleAndKeywords, PyArg
_
ParseTuple, PyArg
_
Parse
Py
_
BuildValue
PyObject, PyVarObject
...
...
Doc/api/api.tex
View file @
9b0eaef5
...
...
@@ -1073,7 +1073,7 @@ for which they do not apply, they will flag a Python exception.
Print an object
\var
{
o
}
, on file
\var
{
fp
}
. Returns
\code
{
-1
}
on error
The flags argument is used to enable certain printing
options. The only option currently supported is
\constant
{
Py
_
P
rint
_
RAW
}
.
\constant
{
Py
_
P
RINT
_
RAW
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyObject
_
HasAttrString
}{
PyObject *o, char *attr
_
name
}
...
...
@@ -1721,28 +1721,40 @@ This instance of \code{PyTypeObject} represents the Python string type.
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyString
_
Check
}{
PyObject *o
}
Returns true if the object
\var
{
o
}
is a string object.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
FromStringAndSize
}{
const char *v,
int len
}
Returns a new string object with the value
\var
{
v
}
and length
\var
{
len
}
on success, and
\NULL
{}
on failure. If
\var
{
v
}
is
\NULL
{}
,
the contents of the string are uninitialized.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
FromString
}{
const char *v
}
Returns a new string object with the value
\var
{
v
}
on success, and
\NULL
{}
on failure.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyString
_
Size
}{
PyObject *string
}
Returns the length of the string in string object
\var
{
string
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
char*
}{
PyString
_
AsString
}{
PyObject *string
}
Resturns a
\NULL
{}
terminated representation of the contents of
\var
{
string
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
void
}{
PyString
_
Concat
}{
PyObject **string,
PyObject *newpart
}
Creates a new string object in
\var
{
*string
}
containing the contents
of
\var
{
newpart
}
appended to
\var
{
string
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
void
}{
PyString
_
ConcatAndDel
}{
PyObject **string,
PyObject *newpart
}
Creates a new string object in
\var
{
*string
}
containing the contents
of
\var
{
newpart
}
appended to
\var
{
string
}
. --WHAT IS THE
DIFFERENCE BETWEEN THIS AND PLAIN CONCAT?--
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{_
PyString
_
Resize
}{
PyObject **string, int newsize
}
...
...
@@ -1852,27 +1864,42 @@ Returns true if its argument is a \code{PyListObject}.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
New
}{
int size
}
Returns a new list of length
\var
{
len
}
on success, and
\NULL
{}
on
failure.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Size
}{
PyObject *list
}
Returns the length of the list object in
\var
{
list
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
GetItem
}{
PyObject *list, int index
}
Returns the item in
\var
{
list
}
at index
\var
{
index
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
SetItem
}{
PyObject *list, int index,
PyObject *item
}
Sets the item at index
\var
{
index
}
in list to
\var
{
item
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Insert
}{
PyObject *list, int index,
PyObject *index
}
Inserts the item
\var
{
item
}
into list
\var
{
list
}
in front of index
\var
{
index
}
and returns true if successful.
For example:
\begin{verbatim}
PyList
_
Insert(list, 0, object);
\end{verbatim}
\end{cfuncdesc}
would insert
\var
{
object
}
at the front of the list.
\begin{cfuncdesc}
{
int
}{
PyList
_
Append
}{
PyObject *list, PyObject *item
}
Appends the object
\var
{
item
}
at the end of list
\var
{
list
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
GetSlice
}{
PyObject *list,
int low, int high
}
Returns a list of the objects in
\var
{
list
}
containing the objects
\emph
{
between
}
\var
{
low
}
and
\var
{
high
}
. Analogous to
\var
{
list[low:high]
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
SetSlice
}{
PyObject *list,
...
...
@@ -1881,12 +1908,14 @@ Returns true if its argument is a \code{PyListObject}.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Sort
}{
PyObject *list
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Reverse
}{
PyObject *list
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
AsTuple
}{
PyObject *list
}
Returns a new tuple object containing the contents of
\var
{
list
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
GET
_
ITEM
}{
PyObject *list, int i
}
...
...
@@ -2051,21 +2080,29 @@ Returns true if its argument is a \code{PyLongObject}.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromLong
}{
long v
}
Returns a new
\code
{
PyLong
}
object from
\var
{
v
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromUnsignedLong
}{
unsigned long v
}
Returns a new
\code
{
PyLong
}
object from an unsigned
\C
{}
long.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromDouble
}{
double v
}
Returns a new
\code
{
PyLong
}
object from the integer part of
\var
{
v
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
long
}{
PyLong
_
AsLong
}{
PyObject *pylong
}
Returns a
\C
{}
\code
{
long
}
representation of the contents of
\var
{
pylong
}
.
WHAT HAPPENS IF
\var
{
pylong
}
> MAXLONG?
\end{cfuncdesc}
\begin{cfuncdesc}
{
unsigned long
}{
PyLong
_
AsUnsignedLong
}{
PyObject *pylong
}
Returns a
\C
{}
\code
{
unsigned long
}
representation of the contents of
\var
{
pylong
}
. WHAT HAPPENS IF
\var
{
pylong
}
> MAXLONG?
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyLong
_
AsDouble
}{
PyObject *pylong
}
Returns a
\C
{}
\code
{
double
}
representation of teh contents of
\var
{
pylong
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromString
}{
char *str, char **pend,
...
...
@@ -2091,9 +2128,11 @@ Returns true if its argument is a \code{PyFloatObject}.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyFloat
_
FromDouble
}{
double v
}
Creates a
\code
{
PyFloat
}
object from
\var
{
v
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyFloat
_
AsDouble
}{
PyObject *pyfloat
}
Returns a
\C
{}
\code
{
double
}
representation of the contents of
\var
{
pyfloat
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyFloat
_
AS
_
DOUBLE
}{
PyObject *pyfloat
}
...
...
@@ -2153,12 +2192,15 @@ Returns true if its argument is a \code{PyComplexObject}.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyComplex
_
FromDoubles
}{
double real, double imag
}
Returns a new
\code
{
PyComplex
}
object from
\var
{
real
}
and
\var
{
imag
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyComplex
_
RealAsDouble
}{
PyObject *op
}
Returns the real part of
\var
{
op
}
as a
\C
{}
\code
{
double
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyComplex
_
ImagAsDouble
}{
PyObject *op
}
Returns the imaginary part of
\var
{
op
}
as a
\C
{}
\code
{
double
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
Py
_
complex
}{
PyComplex
_
AsCComplex
}{
PyObject *op
}
...
...
@@ -2854,6 +2896,11 @@ must be held.
\begin{cfuncdesc}
{
TYPE
}{_
PyObject
_
NEW
_
VAR
}{
TYPE, PyTypeObject *, int size
}
\end{cfuncdesc}
Py
_
InitModule (!!!)
PyArg
_
ParseTupleAndKeywords, PyArg
_
ParseTuple, PyArg
_
Parse
Py
_
BuildValue
PyObject, PyVarObject
...
...
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