diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-09-04 22:08:56 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-09-04 22:08:56 (GMT) |
commit | 7eea37e8317bda88d9f50b862f13642e837957ce (patch) | |
tree | 33b41620f6b0e2266d19d43aa8fad9743f3bb3d4 /Include | |
parent | 2f760c35e2372dc50102305f407e5eed7e7b5c0a (diff) | |
download | cpython-7eea37e8317bda88d9f50b862f13642e837957ce.zip cpython-7eea37e8317bda88d9f50b862f13642e837957ce.tar.gz cpython-7eea37e8317bda88d9f50b862f13642e837957ce.tar.bz2 |
At Guido's suggestion, here's a new C API function, PyObject_Dir(), like
__builtin__.dir(). Moved the guts from bltinmodule.c to object.c.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/object.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Include/object.h b/Include/object.h index 6cd20a6..d9c3514 100644 --- a/Include/object.h +++ b/Include/object.h @@ -346,6 +346,14 @@ extern DL_IMPORT(int) PyNumber_CoerceEx(PyObject **, PyObject **); extern DL_IMPORT(void) (*PyObject_ClearWeakRefs)(PyObject *); +/* PyObject_Dir(obj) acts like Python __builtin__.dir(obj), returning a + list of strings. PyObject_Dir(NULL) is like __builtin__.dir(), + returning the names of the current locals. In this case, if there are + no current locals, NULL is returned, and PyErr_Occurred() is false. +*/ +extern DL_IMPORT(PyObject *) PyObject_Dir(PyObject *); + + /* Helpers for printing recursive container types */ extern DL_IMPORT(int) Py_ReprEnter(PyObject *); extern DL_IMPORT(void) Py_ReprLeave(PyObject *); |