Skip Montanaro added the comment:

Again, my apologies for the crappy initial bug report. Hopefully this comment 
and the two files I just attached demonstrate what I am getting at.

I just uploaded a stupid little example, partial3.py. Stupid, but still, it 
demonstrates part of how I think docstrings on these partial methods could be 
improved. If you run it (I'm using Python 3.6.1), note that the doc strings for 
the sum method (instance and class), look wrong:

Child.sum doc: None
c.sum doc: partial(func, *args, **keywords) - new function with partial 
application
    of the given arguments and keywords.

The file, ft.diff, includes a one-line patch to partialmethod.__get__ which 
corrects the docstring for the instance of the Child class:

Child.sum doc: None
c.sum doc: sum doc

I haven't looked to see where the docstring of Child.sum could be set, but I 
believe it should be fairly straightforward for someone more familiar with this 
code. Also, the patch doesn't improve the output of pydoc:

partial3.Child = class Child(builtins.object)
 |  Methods defined here:
 |  
 |  diff(self, arg1, arg2)
 |      diff doc
 |  
 |  sum = _method(self, arg2)
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30129>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to