Aaron Hall added the comment:
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?
----------
nosy: +Aaron Hall
versions: +Python 3.7 -Python 3.3
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12154>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com