This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Aaron Hall
Recipients Aaron Hall, JJeffries, eric.araujo, ezio.melotti, pconnell, rhettinger
Date 2017-09-03.03:56:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1504410963.2.0.645379017525.issue12154@psf.upfronthosting.co.za>
In-reply-to
Content
It seems that this issue is still properly open. (Another open issue seems be related: http://bugs.python.org/issue30129)

In the docs on partial, we have:

>>> from functools import partial
>>> basetwo = partial(int, base=2)
>>> basetwo.__doc__ = 'convert base 2 string to int'

But the help function doesn't find that __doc__:

>>> help(basetwo)
class partial(builtins.object)
 |  partial(func, *args, **keywords) - new function with partial application
...

Perhaps this could be solved by having PyDoc check for isinstance of a Callable or making partial an instance of a Function?

>>> type(basetwo)
<class 'functools.partial'>
>>> basetwo.__dict__
{'__doc__': 'convert base 2 string to int'}
>>> type(basetwo)
<class 'functools.partial'>
>>> isinstance(basetwo, partial)
True
>>> from types import FunctionType; from collections import Callable
>>> isinstance(basetwo, FunctionType)
False
>>> isinstance(basetwo, Callable)
True

The partial repr seems to get us close:

>>> repr(basetwo)
"functools.partial(<class 'int'>, base=2)"

I haven't dug much further into this, but I'm interested in doing the work to finish it, and I don't think the patch submitted 6 years ago quite gets us there. Any other thoughts before I decide to give it a go?
History
Date User Action Args
2017-09-03 03:56:03Aaron Hallsetrecipients: + Aaron Hall, rhettinger, ezio.melotti, eric.araujo, JJeffries, pconnell
2017-09-03 03:56:03Aaron Hallsetmessageid: <1504410963.2.0.645379017525.issue12154@psf.upfronthosting.co.za>
2017-09-03 03:56:03Aaron Halllinkissue12154 messages
2017-09-03 03:56:02Aaron Hallcreate