Skip to content

Error message in numpy.broadcast is wrong #6898

Closed
@kohr-h

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.

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