Hi Breno,

Part of what you want is implemented by using `out=...`, though I can
see the benefit of that happening by default.

All the best,

Marten

Breno Augusto Favaretto via NumPy-Discussion
<[email protected]> writes:

> Hello NumPy developers,
>
> I would like to propose an optional mechanism to control the behavior
> of 0-dimensional array return conversion in PyArray_Return.
>
> Currently, 0D NumPy arrays are automatically converted into Python
> scalars in many operations. In some workflows, it is desirable to
> preserve the ndarray object instead.
>
> Proposed idea:
> - Introduce an opt-in mechanism (initially implemented as a global flag)
>    to control whether 0D arrays are converted to scalars or preserved
>    as ndarray objects.
> - Default behavior remains unchanged for full backward compatibility.
>
> Motivation:
> In certain array-centric workflows, implicit scalar conversion of 0D
> arrays can lead to loss of consistency when uniform ndarray behavior
> is desired.
>
> I have implemented a prototype PR here:
> <https://github.com/numpy/numpy/pull/31221>
>
> However, I was informed that this kind of change requires prior
> discussion on the mailing list before proceeding further.
>
> I would appreciate feedback on:
> - whether this direction is acceptable
> - whether a global flag is appropriate
> - or if an alternative design (context-local, function-level, etc.)
>    would be preferred
>
> Thank you for your time.
>
> _______________________________________________
> 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]
_______________________________________________
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