On Thu, Mar 7, 2024 at 4:39 AM <kaistri...@gmail.com> wrote:

> Hi all,
>
> I'd like to raise the idea of updating the ``scipy.sparse.csgraph`` API to
> use result objects rather than a mutable return signature. This was raised
> by Jake from [scipy-20187](https://github.com/scipy/scipy/pull/20187) and
> I think he has the right idea. Specifically I agree with:
>
> "These mutating signatures tend to be quite nasty especially as it doesn't
> save on computation. Elsewhere in SciPy we often use results objects"
>
> Should there be some effort to rework the csgraph API to utilise a result
> object?
>

I don't think so. While we have learned that it is typically not good API
design with `return_xxx` keywords that control how many return values a
function has, the problems that such keywords create really aren't large
enough to justify breaking changes to an otherwise well-designed API.
Moreover, result objects don't quite solve the problems with static typing
or being friendly to JIT compilers - that remains unchanged.

Result objects in `optimize`, `integrate` and `stats` are useful to collect
many return values, and they can also help with making functions extensible
(adding extra/optional return values). But those aren't problems that the
csgraph functions have.

Cheers,
Ralf
_______________________________________________
SciPy-Dev mailing list -- scipy-dev@python.org
To unsubscribe send an email to scipy-dev-le...@python.org
https://mail.python.org/mailman3/lists/scipy-dev.python.org/
Member address: arch...@mail-archive.com

Reply via email to