Skip to content

_cosmology_not_equal documents an out parameter it does not take #20208

Description

@darkdi

Following up on #20205, where @pllim asked me to open one issue per remaining problem. Same subpackage as #20206 but a separate problem.

_cosmology_not_equal documents an out parameter it does not take:

@_comparison_decorator
def _cosmology_not_equal(cosmo1: Any, cosmo2: Any, /, *, allow_equivalent: bool = False) -> bool:
    """...
    out : ndarray, None, optional
        A location into which the result is stored. If provided, it must have a
        shape that the inputs broadcast to. If not provided or None, a
        freshly-allocated array is returned.

The signature takes only cosmo1, cosmo2 and allow_equivalent. format in the same docstring is legitimate — _comparison_decorator states in its own Notes that every decorated function should document it — but out is not mentioned there and is not accepted anywhere along that path. The wording reads like it was lifted from a numpy ufunc docstring.

cosmology_equal right above it has the same structure and does not carry an out entry, which suggests this one is simply stale rather than describing something intended.

The function is private, so nothing user-facing depends on it; removing the entry looks safe, but since it is your call whether out was planned, I left it out of #20205. Happy to send a one-line PR removing it.

Found with a static checker comparing numpydoc parameter names against the signature below them; each finding was read by hand.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions