[issue19404] Simplify per-instance control of help() output

2015-07-21 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy:  -ethan.furman

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19404
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19404] Simplify per-instance control of help() output

2014-01-31 Thread Yury Selivanov

Changes by Yury Selivanov yselivanov...@gmail.com:


--
nosy: +yselivanov

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19404
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19404] Simplify per-instance control of help() output

2013-10-26 Thread Nick Coghlan

New submission from Nick Coghlan:

While working on issue 19330, I also took a look at whether or not I could fix 
the @contextmanager decorator to also provide useful help information on the 
resulting objects. This turned out to be difficult, since calling decorated 
functions produces instances of contextlib._GeneratorContextManager, and help() 
insists on showing the docs for that rather than a __doc__ attribute set on the 
context manager instance itself.

This behaviour appears to be ultimately due to pydoc.render_doc(), which has 
a hardcoded list of conditions it checks to decide whether to document the 
instance directly or to provide the class documentation instead:
http://hg.python.org/cpython/file/2b904290b3b9/Lib/pydoc.py#l1544

This first idea that comes to mind is to simply add the additional condition 
that if obj.__doc__ != type(obj).__doc__, then help() shouldn't replace the 
object with it's type. The simple trick that I originally explored was simply 
setting the __doc__ attribute on the _GeneratorContextManager instance based on 
the docstring of the decorated function, and I believe that approach might work 
for property instances, too (rather than needing to hardcode the isinstance 
check into render_doc()). It may even handle some of the other currently 
hardcoded conditions in that list.

--
components: Library (Lib)
messages: 201322
nosy: ethan.furman, ncoghlan
priority: normal
severity: normal
status: open
title: Simplify per-instance control of help() output
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19404
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19404] Simplify per-instance control of help() output

2013-10-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 09153a9a3bb9 by Nick Coghlan in branch 'default':
Close #19330 by using public classes in contextlib
http://hg.python.org/cpython/rev/09153a9a3bb9

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19404
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19404] Simplify per-instance control of help() output

2013-10-26 Thread Nick Coghlan

Nick Coghlan added the comment:

Issue 19031 is a report indicating that this is a problem for Enum instances as 
well.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19404
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19404] Simplify per-instance control of help() output

2013-10-26 Thread Ethan Furman

Ethan Furman added the comment:

Would it make sense to have the presence of a non-None __doc__ be a deciding 
factor?  How often does an instance have a docstring where one would want the 
class info instead?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19404
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19404] Simplify per-instance control of help() output

2013-10-26 Thread Nick Coghlan

Nick Coghlan added the comment:

As far as I am aware, never. But instance.__doc__ falls back to the
class, hence the != check rather than is not None.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19404
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com