Skip to content

ENH: Add subok parameter to np.copy function#6509

Closed
jjhelmus wants to merge 1 commit intonumpy:masterfrom
jjhelmus:copy_subok
Closed

ENH: Add subok parameter to np.copy function#6509
jjhelmus wants to merge 1 commit intonumpy:masterfrom
jjhelmus:copy_subok

Conversation

@jjhelmus
Copy link
Contributor

The subok parameter determines if sub-classes are passed through. Setting the argument to True will cause sub-classes, such as MaskedArrays, to be returned after copying. The default, False, force the copy to be of the base-class, to maintain backwards compatibility.

The subok parameter determines if sub-classes are passed through.
@charris charris changed the title API: Add subok parameter to np.copy function ENH: Add subok parameter to np.copy function Oct 24, 2015
@seberg
Copy link
Member

seberg commented Mar 2, 2016

Sounds reasonable to me (i.e. not much extra clutter ;)) so +0.5 from me. Would need a .. versionadded:: tag on the new parameter.

assert np.ma.isMaskedArray(np.copy(mx, subok=True))
assert not np.ma.isMaskedArray(np.copy(mx, subok=False))
# default is to force base class
assert not np.ma.isMaskedArray(np.copy(mx))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be using the assert_ function

@OmerJog
Copy link

OmerJog commented Feb 19, 2019

@jjhelmus are you proceeding with this?

@jjhelmus
Copy link
Contributor Author

@jjhelmus are you proceeding with this?

This PR has lingered for too long that I do not recall why the changes were needed. I'm closing as I do not have the time to reexamine this.

@jjhelmus jjhelmus closed this Feb 19, 2019
rossbar added a commit to rossbar/numpy that referenced this pull request Mar 2, 2020
Re-introduces changes originally proposed in numpy#6509 which was
closed due to very long review period.
seberg pushed a commit that referenced this pull request Mar 11, 2020
This is largely a re-submission of the original change proposed in #6509. Discussion was hosted in multiple forums including #3474, the numpy mailing list circa 10-2015, and the 02-26-2020 NumPy Triage meeting.

This PR closes #3474 and #15570
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants