[issue9118] help() on a property descriptor launches interactive help

Terry J. Reedy report at bugs.python.org
Sun Jul 4 05:55:14 CEST 2010


Terry J. Reedy <tjreedy at udel.edu> added the comment:

I agree that help(None) should return help on None but suggest a change to the patch.

I understand that the point of changing
-    def __call__(self, request=None):
to the somewhat opaque
+    def __call__(self, *args):
+        try:
+            request, = args
+        except ValueError:
is to make help() work the same as now without defaulting request to None. However, I believe that it will change help(1,2) to being the same as help() instead raising TypeError. I do not think that that API change is desirable. This can be avoided by instead creating a private sentinel. The alternate replacement would be

+    __GoInteractive = object()
+    def __call__(self, request=__GoInteractive):
+        if request is not __GoInteractive:
-        if request is not None:

with the rest of code the unchanged.

----------
nosy: +tjreedy

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9118>
_______________________________________


More information about the Python-bugs-list mailing list