Skip to content

Error message in numpy.broadcast is wrong #6898

Closed

Description

@kohr-h

The error message regarding the maximum number of arguments is wrong in broadcast:

>>> x = np.arange(3)
>>> args = [x] * 32
>>> np.broadcast(*args).shape
(3,)
>>> args = [x] * 33
>>> np.broadcast(*args).shape
Traceback (most recent call last):
...
ValueError: Need at least two and fewer than (32) array objects.

The point is that 32 still works, while it shouldn't according to the error message. Correct would be to require at most 32 array objects. Not sure why 32 is in brackets.

Activity

  1. gfyoung commented on Dec 30, 2015

    @gfyoung
    Contributor

    They probably meant to put inclusive in that error message, though I think there should be some rewording to make the error clearer. Should be a relatively easy fix.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions