-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
majorInclude in major changes release notes sectionInclude in major changes release notes section
Description
Description of your problem
PyMC sideliner here, who is finally taking a proper crack at it with 4.0. I find the distribution docstrings difficult to parse when viewing them in my editor. As an example, the Bernoulli distribution in jupyter notebook (I imagine a lot of people are using notebooks):
import pymc as pm
pm.Bernoulli()And with VSCode (I am using this):

Two points:
- My main gripe is with the arguments being shown as
pm.Bernoulli(name, *args, **kwargs)/(name: Unknown, *args: Unknown, **kwargs: Unknown) -> TensorVariable. It would be much nicer to actually show the parameters taken by the distribution (in this case,p). - The second point is a bit more complicated: VSCode tries to show the docstring of the
__init__method rather than the class docstring*. SinceBernoullidoesn't have an explicit init method, it inherits from the first one it finds, which seems to be the__new__method of theDistributionclass. Note that if you position the cursor (|) asBernoulli|()when invoking the documentation, you get the Bernoulli class docs and not the parent new doc. It would be nice to supply a simple docstring to the init method in order to override the confusing parentDIstributiondocstring.
I am quite happy to take a crack at this, though I do recognise that there are several other issues concerned with similar things #5308, #5353, #5358)
- class docstring vs init docstring:
class A:
"class docstring"
def __init__(self, a: int, b: str = "hi"):
"init docstring"
print(a, b)Versions and main components
- PyMC/PyMC3 Version: 4.0
- Python Version: 3.9
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
majorInclude in major changes release notes sectionInclude in major changes release notes section
