mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
#6421: The self argument of module-level PyCFunctions is now a reference to the module object.
This commit is contained in:
parent
216cca7d44
commit
21dc5bacad
2 changed files with 9 additions and 13 deletions
|
|
@ -82,10 +82,8 @@ example, the single expression ``"ls -l"``) to the arguments passed to the C
|
|||
function. The C function always has two arguments, conventionally named *self*
|
||||
and *args*.
|
||||
|
||||
The *self* argument is only used when the C function implements a built-in
|
||||
method, not a function. In the example, *self* will always be a *NULL* pointer,
|
||||
since we are defining a function, not a method. (This is done so that the
|
||||
interpreter doesn't have to understand two different types of C functions.)
|
||||
The *self* argument points to the module object for module-level functions;
|
||||
for a method it would point to the object instance.
|
||||
|
||||
The *args* argument will be a pointer to a Python tuple object containing the
|
||||
arguments. Each item of the tuple corresponds to an argument in the call's
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue