Opened 5 years ago

Closed 5 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: |

### 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 5 years ago by

Branch: | → u/jdemeyer/sage_getdoc_original___finds_wrong_doc |
---|

### comment:2 Changed 5 years ago by

Authors: | → Jeroen Demeyer, Erik Bray |
---|---|

Commit: | → c1c83e36c9b9fbf4daf753ff4ed0277e8f1b43ab |

Status: | new → needs_review |

### comment:3 follow-up: 4 Changed 5 years ago by

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 Changed 5 years ago by

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 5 years ago by

Reviewers: | → Erik Bray |
---|

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

### comment:6 Changed 5 years ago by

Status: | needs_review → positive_review |
---|

### comment:7 Changed 5 years ago by

Branch: | u/jdemeyer/sage_getdoc_original___finds_wrong_doc → c1c83e36c9b9fbf4daf753ff4ed0277e8f1b43ab |
---|---|

Resolution: | → fixed |

Status: | positive_review → closed |

**Note:**See TracTickets for help on using tickets.

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

New commits:

`Replace 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`

`Only take __init__.__doc__ from the actual class`