Skip to content

reduction "dtype" is required but docstring says optional #6278

Closed

Description

@djhoese

What happened:

I'm playing around with the dask.array.reduction function while working on a custom algorithm and was confused when I got a ValueError for not specifying the dtype when the docstring says it is optional and will default to x.dtype if not provided. See:

if dtype is None:
raise ValueError("Must specify dtype")

What you expected to happen:

Either do the default that the docstring says or make dtype a required argument.

Minimal Complete Verifiable Example:

I can make one if you really need it, but this is more of a behavioral question about what is actually desired. Is defaulting to the input array's dtype going to cause issues in the future (has it happened in other dask functions)? If so, I'll update the docstring and make a PR. If not, I'll update the code to default to x.dtype.

Activity

  1. jsignell commented on Jun 2, 2020

    @jsignell
    Member

    Thanks @djhoese for reporting this. I think if dtype isn't provided it should be inferred from doing the operation on meta like map_blocks does. As far as I can tell, this mandatory dtype was implemented in #1755, so I'm pinging @jcrist in case he has input on what the behavior should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions