Skip to content

Dimension subclasses should have more specific docstrings #69

@maffoo

Description

@maffoo

I noticed that the docstring for tunits.Time and other dimension subclasses inherit their docstrings from the base class:

In [1]: import tunits In [2]: tunits.Time? Init signature: tunits.Time(val, unit=None, validate: 'bool' = True) Docstring: Dimension abstraction. This abstract class allows the creation of values that belong to a dimension (e.g. t: Time, x: Length, ...etc). This allows us to use static types to check code correctness (e.g. time_method(t: Time)). To add a new dimension, create 3 classes: - `class _NewDimension(Dimension):` which implements the abstract methods from this class. - `class NewDimension(_NewDimension, ValueWithDimension)` which represents scalar values and doesn't need to implement any methods. - `class AccelerationArray(_Acceleration, ArrayWithDimension)` which represents an array of values sharing the same dimension and unit. Init docstring: ValueWithDimension.__init__(self, val, unit=None, validate: bool = True) File: ~/.virtualenvs/pyle/lib/python3.12/site-packages/tunits_core.cpython-312-x86_64-linux-gnu.so Type: ABCMeta Subclasses: 

It would be nice to add more informative docstrings for specific dimension classes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedHelp with this would be appreciated

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions