Skip to content

Proposal: add an optional copy argument to np.reshape #9818

@shoyer

Description

@shoyer

Inspired by my discussion with @charris in #9810, I would like to propose adding an optional copy argument to np.reshape() and ndarray.reshape().

Proposed semantics:

  • copy=None: copy only if necessary (default).
  • copy=True: always copy.
  • copy=False: never copy. Raise an error if the data cannot be reshaped without a copy.

This would allow users to ensure desired behavior for reshape and alleviate the primary use case for modifying ndarray.shape.

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