Thanks for the feedback.

I agree that using global state (flags or a context manager) introduces issues, 
especially for static typing and in multi-threaded contexts.

My main motivation is ensuring consistent return types. The implicit conversion 
from 0D arrays to scalars can be surprising and makes type reasoning less 
predictable.

My initial idea was to introduce a flag for `np.clip` to control this behavior, 
but my implementation ended up being quite indirect.

While `out=` provides a way to preserve 0D arrays, it feels somewhat indirect 
and not very ergonomic for this use case.

An explicit API would likely be preferable over global state, but I also 
realize it may not be practical given how deeply this behavior is embedded 
across ufuncs and other functions.

Curious to hear if something along those lines would be more acceptable.
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/numpy-discussion.python.org
Member address: [email protected]

Reply via email to