anesthetic icon indicating copy to clipboard operation
anesthetic copied to clipboard

Inheriting docstrings from Pandas in python >= 3.5

Open AdamOrmondroyd opened this issue 2 years ago • 1 comments

For python >= 3.5, if an overridden function lacks a docstring, then it looks up the inheritance tree to find one.

For example, if one were to delete the docstring from anesthetic.weighted_pandas.WeightedDataFrame.quantile(), then instead we would see the docstring from Pandas through help() or in an IDE such as VS Code.

import anesthetic as ac
ns = ac.read_chains("anesthetic/tests/example_data/pc")
help(ns.quantile)
195666578-6f9fcf8d-6a8a-4246-ae97-20936d15576e

Perhaps it would be good to make use of this in anesthetic?

AdamOrmondroyd avatar Oct 13 '22 18:10 AdamOrmondroyd

Thanks for pointing this out! This might resolve (part of) #22.

lukashergt avatar Oct 13 '22 18:10 lukashergt