diff options
| author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-18 14:06:54 +0200 |
|---|---|---|
| committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-18 14:06:54 +0200 |
| commit | 23e41c9686435a8a01da7fead079c783087ee5c5 (patch) | |
| tree | 0593cf00b74bcabb8cb52c2108750c2f80fa2c81 /Doc/c-api/object.rst | |
| parent | 68a2b84e68c3fe3abaa1bae589e17bfbb13461c2 (diff) | |
| parent | e93555d91c4608e06e3058a42af0f2450c9dfd19 (diff) | |
| download | cpython-23e41c9686435a8a01da7fead079c783087ee5c5.tar.gz | |
#16306: merge with 3.3.
Diffstat (limited to 'Doc/c-api/object.rst')
| -rw-r--r-- | Doc/c-api/object.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst index d895547f1f..e4769b3580 100644 --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -342,6 +342,15 @@ is considered sufficient for this determination. returned. This is the equivalent to the Python expression ``len(o)``. +.. c:function:: Py_ssize_t PyObject_LengthHint(PyObject *o, Py_ssize_t default) + + Return an estimated length for the object *o*. First trying to return its + actual length, then an estimate using ``__length_hint__``, and finally + returning the default value. On error ``-1`` is returned. This is the + equivalent to the Python expression ``operator.length_hint(o, default)``. + + .. versionadded:: 3.4 + .. c:function:: PyObject* PyObject_GetItem(PyObject *o, PyObject *key) Return element of *o* corresponding to the object *key* or *NULL* on failure. |
