[Python-3000-checkins] r59426 - python/branches/py3k/Lib/io.py
christian.heimes
python-3000-checkins at python.org
Sat Dec 8 18:47:40 CET 2007
Author: christian.heimes
Date: Sat Dec 8 18:47:40 2007
New Revision: 59426
Modified:
python/branches/py3k/Lib/io.py
Log:
Added descriptor for builtins.open.__doc__
Before the change help(open) didn't return anything helpful but the doc string of io.OpenWrapper. Now it shows the user the documentation of io.open.
Modified: python/branches/py3k/Lib/io.py
==============================================================================
--- python/branches/py3k/Lib/io.py (original)
+++ python/branches/py3k/Lib/io.py Sat Dec 8 18:47:40 2007
@@ -189,6 +189,14 @@
text.mode = mode
return text
+class _DocDescriptor:
+ """Helper for builtins.open.__doc__
+ """
+ def __get__(self, obj, typ):
+ return (
+ "open(file, mode='r', buffering=None, encoding=None, "
+ "errors=None, newline=None, closefd=True)\n\n" +
+ open.__doc__)
class OpenWrapper:
"""Wrapper for builtins.open
@@ -198,6 +206,8 @@
See initstdio() in Python/pythonrun.c.
"""
+ __doc__ = _DocDescriptor()
+
def __new__(cls, *args, **kwargs):
return open(*args, **kwargs)
More information about the Python-3000-checkins
mailing list