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.
This commit is contained in:
Tim Peters 2001-09-04 22:08:56 +00:00
parent 2f760c35e2
commit 7eea37e831
5 changed files with 167 additions and 138 deletions

View file

@ -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 *);