Thanks for the input, Ralf!

On 5 Mar 2020, at 9:04 am, Ralf Gommers <ralf.gommers@gmail.com> wrote:
Just in case you're not aware of it, there's a nice Bunch design pattern that we've been discussing for a long time for scipy.stats, for the same reason of adding more return values. It allows you to do this in a backwards-compatible way, see https://github.com/scipy/scipy/issues/3665#issuecomment-451038177. The main idea is to freeze the number of arguments returned by tuple unpacking, and have namedtuple-like behavior otherwise (which is preferred for new code).

Besides not breaking user code, the advantages would be to be able to make changes incrementally, also post-1.0.

I might not be getting the full picture here: returning Bunches instead of (in most places) NumPy arrays would in itself be a breaking change? Similarly, one of the big changes we are proposing is returning an array of floats that is *not* rescaled to [0, 1]. That is, we want to still return a NumPy array (whether that is the plain array or an attribute in the Bunch) but the values in the array will be different. I don’t clearly see how Bunch solves that problem?

Finally, it seems to me that dataclasses, being now (3.7) in the standard library and offering a few more features, might be a preferred option for this use case?

Thank you!

Juan.