True, but the pure Python and C implementation differ. Is that intentional? I find the current behaviour confusing. The doc states only that partial object does not set the __doc__ attribute, not that the attribute might be ignored. I had a peek at the pydoc module. It uses inspect to determine the type of object in question through the inspect.isXXX() functions. My h is a function, while g is not.
This is a follow-up on my previous problem with sphinx not recognizing the doc string. I don't know whether this and sphinx issues are related. My basic question is how to document functions created by functools.partial, such that the documentation can be viewed not only by reading the code. Of course, as the last resort, I could create my own implementation (i.e. copy the pure Python code). George On Wed, Apr 6, 2016 at 6:39 PM, Michael Selik <michael.se...@gmail.com> wrote: > > > On Apr 6, 2016, at 6:57 PM, George Trojan - NOAA Federal < > george.tro...@noaa.gov> wrote: > > > > The module functools has partial() defined as above, then overrides the > > definition by importing partial from _functools. That would explain the > > above behaviour. My question is why? > > A couple speculations why an author might retain a vestigial Python > implementation after re-implementing in C: to provide a backup in case the > C fails to compile or to simply provide an easier-to-read example of what > the C is doing. > > -- https://mail.python.org/mailman/listinfo/python-list