Move DataManager.copy(None)
functionality to a new, dinstinct function
#6303
Labels
DataManager.copy(None)
functionality to a new, dinstinct function
#6303
Suggested for v4.0.0, as this would introduce breaking changes!
Discussed in #6265
Summarized from discussion posted by ESadek-MO December 17, 2024, with contributions from bjlittle and pp-mo
The current behavior of
Cube.copy(None)
is to copy the cube exactly, without replacing the data.This no longer fits the contract that will be implemented with #6253, for a few reasons:
None
means "No data", as opposed to just meaning the absence of anything. This creates a confusing message,Cube(None, shape=(...))
creates a dataless cube, butCube.copy(None)
doesn't remove the data, but maintains it.The new idea would be to separate out the replace functionality. So you'd have cube.copy(), which would only create a copy, and cube.replaced() (name undecided) which would use copy, and copy and replace the data.
This would mean Cube.copy would always return the same type of cube i.e., if you give it a cube with data then it will always return a duplicate cube with data, and if you give it a cube without data then it will always return a duplicate cube without data, which is a cleaner, simpler contract.
Some further things to think on:
The text was updated successfully, but these errors were encountered: