diff options
author | Georg Brandl <georg@python.org> | 2007-03-12 13:17:36 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-03-12 13:17:36 (GMT) |
commit | 871f1bc6011c1644b1be2e87518c435e7fb552ad (patch) | |
tree | d318b919f33e98d18b0faa4289a9cfe54e555a6e /Python | |
parent | 2681beb23e3a8d9d905d99f9e67bb0389264f44f (diff) | |
download | cpython-871f1bc6011c1644b1be2e87518c435e7fb552ad.zip cpython-871f1bc6011c1644b1be2e87518c435e7fb552ad.tar.gz cpython-871f1bc6011c1644b1be2e87518c435e7fb552ad.tar.bz2 |
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index f6c4ebb..eef68e4 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -495,15 +495,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) |