Roundup Robot added the comment:
New changeset 4476b578b8fd by Berker Peksag in branch '3.5':
Issue #15582: Add a whatsnew entry for inspect.getdoc() changes in 3.5.
https://hg.python.org/cpython/rev/4476b578b8fd
New changeset e0f4a5f09bfa by Berker Peksag in branch 'default':
Issue #15582: Add
Berker Peksag added the comment:
Applied, thanks!
--
nosy: +berker.peksag
stage: patch review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
Martin Panter added the comment:
Merged the current What’s New page in getdoc-news.v2.patch. Is there any
interest in applying this?
--
stage: resolved - patch review
Added file: http://bugs.python.org/file40062/getdoc-news.v2.patch
___
Python
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: -ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
___
Python-bugs-list
Martin Panter added the comment:
getdoc-news.patch suggests some wording to add to What’s New, and also adds a
“Changed in version 3.5” note to inspect.getdoc().
BTW I also noticed that the class doc strings are not inherited from
object.__doc__, although method doc strings _are_ inherited
Nick Coghlan added the comment:
Yes, this was a deliberate change to flip the default as to which subclasses
get bad docstring behaviour.
In the status quo, if you provide a subclass method which does basically the
same thing as the parent class, you lose the docstring unless you duplicate
Ethan Furman added the comment:
I know it will take some time to add doc strings to places where they are
missing, but I would not roll-back the patch for that. File new issues and get
the over-riding methods properly documented.
--
___
Python
Martin Panter added the comment:
My example was taken from a package that tends to “properly document”
everything in separate documentation files, rather than in the source code. I
don’t really think Python should dictate if and how one document their code
based on what base classes they use,
Martin Panter added the comment:
Sometimes the doc string for the overridden method does not make much sense in
the context of the subclass. Just wondering if this was considered; it seems
like a fairly serious downside to this new feature. E.g. in a package I am
reviewing, there is a class
Changes by Serhiy Storchaka storch...@gmail.com:
--
status: closed - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
___
Ethan Furman added the comment:
Sounds like good incentive to add good docstrings. :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
Serhiy Storchaka added the comment:
I were aware that this can propagate some not well appropriate docstrings from
abstract base classes, but Martin expose worse problem: inheriting a docstring
by the method with changed signature.
Perhaps we should check if a signature of overriding method
Nick Coghlan added the comment:
I filed issue #23900 to consider the question of the default docstring for Enum
subclasses.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: - fixed
stage: patch review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
Serhiy Storchaka added the comment:
Changed test_enum to make buildbots green, but perhaps the docstring of Enum
should be changed, because it now is used for all Enum subclasses that doesn't
define a docstring explicitly. An alternative solution is to set __doc__ of
Enum subclasses to an
Roundup Robot added the comment:
New changeset 47a61a1c97b3 by Serhiy Storchaka in branch 'default':
Fixed test_enum for issue #15582.
https://hg.python.org/cpython/rev/47a61a1c97b3
--
___
Python tracker rep...@bugs.python.org
Roundup Robot added the comment:
New changeset 157b7055bb9d by Serhiy Storchaka in branch 'default':
Issue #15582: inspect.getdoc() now follows inheritance chains.
https://hg.python.org/cpython/rev/157b7055bb9d
--
nosy: +python-dev
___
Python tracker
Serhiy Storchaka added the comment:
Unfortunately this enhancement breaks test_enum.
==
FAIL: test_pydoc (test.test_enum.TestStdLib)
--
Traceback (most recent
Nick Coghlan added the comment:
Serhiy's patch looks good to me.
I'd completely missed that __qualname__ could be used to avoid needing a second
argument even when handling objects other than bound methods. That's very cool,
and I can see why you figured it was easier to just write the patch
Claudiu Popa added the comment:
The patch adds support only for unbound methods and requires additional
parameter for this.
Just curios, which part works only for unbound methods?
It is not what should be done in this issue at all.
It should be easier to write it myself than describe it.
Changes by Serhiy Storchaka storch...@gmail.com:
--
nosy: +serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
___
Serhiy Storchaka added the comment:
The patch adds support only for unbound methods and requires additional
parameter for this. It is not what should be done in this issue at all.
I'm interested in this issue so I'll write a patch. It should be easier to
write it myself than describe it.
Serhiy Storchaka added the comment:
Here is a patch that supports classes, bound and unbound methods, class
methods, properties, method and class descriptors.
--
Added file: http://bugs.python.org/file38414/inspect_getdoc_inherited.patch
___
Python
Claudiu Popa added the comment:
Yury, regarding your last message, is it actually possible to have a subclass
which doesn't have a __doc__ attribute in its __dict__, except using slots?
__doc__ seems to be set to None every time if it's not specified, so I don't
know how could I detect the
Yury Selivanov added the comment:
@Claudiu, you should also add this test and make sure that it passes:
class Parent:
__doc__ = 'some documentation'
class Child(Parent):
__doc__ = None
assert getdoc(Child) is None
In other words -- we use __doc__ defined in parent
Claudiu Popa added the comment:
Alright, I'll update my patch later this week.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
___
Changes by Claudiu Popa pcmantic...@gmail.com:
--
stage: needs patch - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
___
Claudiu.Popa added the comment:
Yury, Nick, how is my latest patch?
--
Added file: http://bugs.python.org/file34733/issue15582_1.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
Changes by Claudiu.Popa pcmantic...@gmail.com:
Added file: http://bugs.python.org/file34445/issue15582.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
Changes by Yury Selivanov yselivanov...@gmail.com:
--
versions: +Python 3.5 -Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
Claudiu.Popa added the comment:
Hello!
Here's a patch. Currently it lacks doc updates, but if the solution is okay,
then I could provide them.
--
keywords: +patch
nosy: +Claudiu.Popa
Added file: http://bugs.python.org/file33118/inspect_getdoc.patch
Eric Snow added the comment:
I have just the thing for this, but haven't had a chance to put a patch
together. I might be able to get to it in the next week if Dave bitey
Beazley isn't too much of a distraction. :)
--
___
Python tracker
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +eric.araujo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15582
___
___
Python-bugs-list
New submission from Nick Coghlan:
Currently, if you override a method from a base class, the docstring is not
inherited, even if it remains accurate.
This issue proposes an enhancement to inspect.getdoc() that allows the
docstring to be retrieved from the inheritance hierarchy in the case
34 matches
Mail list logo