[Numpy-discussion] copy="never" discussion and no deprecation cycle?

Stefan van der Walt stefanv at berkeley.edu
Wed Jun 23 22:25:23 EDT 2021

On Wed, Jun 23, 2021, at 18:01, Juan Nunez-Iglesias wrote:
> Personally I was a fan of the Enum approach. People dislike it because 
> it is not “Pythonic”, but imho that is an accident of history because 
> Enums only appeared (iirc) in Python 3.4. In fact, they are the right 
> data structure for this particular problem, so for my money we should 
> *make it* Pythonic by starting to use it everywhere where we have a 
> finite list of choices.

The enum definitely feels like the right abstraction. But the resulting API is clunky because of naming and top-level scarcity.

Hence the suggestion to tag it onto np.copy, but there is an argument to be made for consistency by placing all enums under np.flags or similar.

Still, np.flags.copy.IF_NEEDED gets long.


More information about the NumPy-Discussion mailing list