summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-03-10 22:13:27 (GMT)
committerGeorg Brandl <georg@python.org>2007-03-10 22:13:27 (GMT)
commite32b4224d0e5a5a2faa7398211ad859e8a4cb0c8 (patch)
tree89c1a560b9940d1c8c68bf451916c9143fe1a0b5 /Python
parentaf334387d12e12677460b4f558ed0a670fdfcebf (diff)
downloadcpython-e32b4224d0e5a5a2faa7398211ad859e8a4cb0c8.zip
cpython-e32b4224d0e5a5a2faa7398211ad859e8a4cb0c8.tar.gz
cpython-e32b4224d0e5a5a2faa7398211ad859e8a4cb0c8.tar.bz2
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 3c149e4..5d87744 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -427,15 +427,16 @@ builtin_dir(PyObject *self, PyObject *args)
PyDoc_STRVAR(dir_doc,
"dir([object]) -> list of strings\n"
"\n"
-"Return an alphabetized list of names comprising (some of) the attributes\n"
-"of the given object, and of attributes reachable from it:\n"
-"\n"
-"No argument: the names in the current scope.\n"
-"Module object: the module attributes.\n"
-"Type or class object: its attributes, and recursively the attributes of\n"
-" its bases.\n"
-"Otherwise: its attributes, its class's attributes, and recursively the\n"
-" attributes of its class's base classes.");
+"If called without an argument, return the names in the current scope.\n"
+"Else, return an alphabetized list of names comprising (some of) the attributes\n"
+"of the given object, and of attributes reachable from it.\n"
+"If the object supplies a method named __dir__, it will be used; otherwise\n"
+"the default dir() logic is used and returns:\n"
+" for a module object: the module's attributes.\n"
+" for a class object: its attributes, and recursively the attributes\n"
+" of its bases.\n"
+" for an other object: its attributes, its class's attributes, and\n"
+" recursively the attributes of its class's base classes.");
static PyObject *
builtin_divmod(PyObject *self, PyObject *args)