Opened 4 years ago

Closed 4 years ago

#24936 closed defect (fixed)

sage_getdoc_original() finds wrong doc

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-8.2
Component: documentation Keywords:
Cc: nthiery, embray Merged in:
Authors: Jeroen Demeyer, Erik Bray Reviewers: Erik Bray
Report Upstream: N/A Work issues:
Branch: c1c83e3 (Commits, GitHub, GitLab) Commit: c1c83e36c9b9fbf4daf753ff4ed0277e8f1b43ab
Dependencies: Stopgaps:

Status badges

Description

sage: from sage.misc.sageinspect import *
sage: print(sage_getdoc_original(sage.categories.category_types.AbelianCategory))

        Initializes this category.

        EXAMPLES::

            sage: class SemiprimitiveRings(Category):
...

This is the doc for Category.__init__ and it seems incorrect to use this as doc for AbelianCategory.

Change History (7)

comment:1 Changed 4 years ago by jdemeyer

  • Branch set to u/jdemeyer/sage_getdoc_original___finds_wrong_doc

comment:2 Changed 4 years ago by jdemeyer

  • Authors set to Jeroen Demeyer, Erik Bray
  • Commit set to c1c83e36c9b9fbf4daf753ff4ed0277e8f1b43ab
  • Status changed from new to needs_review

Erik: I moved the first commit of #24312 to this ticket. This is meant to make it easier to review #24312.


New commits:

6c09c50Replace the argument name 'object' with just 'obj'--this is consistent with other functions in this module, and doesn't involve a jarring overwrite of a built-in
c1c83e3Only take __init__.__doc__ from the actual class

comment:3 follow-up: Changed 4 years ago by embray

I'm not necessarily sure this is the best case either. I could imagine cases where I would want to inherit the docstring from the base class's __init__. Better though would be to just write docstrings for each class where applicable...

comment:4 in reply to: ↑ 3 Changed 4 years ago by jdemeyer

Replying to embray:

I could imagine cases where I would want to inherit the docstring from the base class's __init__.

Maybe, but inheriting docstrings is not what Python does, so that should be considered a bug unless explicitly asked for.

comment:5 Changed 4 years ago by embray

  • Reviewers set to Erik Bray

Alright then, I trust you've thought it through.

comment:6 Changed 4 years ago by embray

  • Status changed from needs_review to positive_review

comment:7 Changed 4 years ago by vbraun

  • Branch changed from u/jdemeyer/sage_getdoc_original___finds_wrong_doc to c1c83e36c9b9fbf4daf753ff4ed0277e8f1b43ab
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.