[Numpy-discussion] Re: Proposing a flattening functionality for deeply nested lists in NumPy

2024-12-30 Thread Dom Grigonis via NumPy-Discussion
Hi Mark, I think this has already been implemented. For Iterables (list included), there is `more_itertools.collapse`, which you can use to achieve examples in your code as `list(more_itertools.collapse(list))`. See: https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.colla

[Numpy-discussion] Re: Proposing a flattening functionality for deeply nested lists in NumPy

2024-12-30 Thread matti picus via NumPy-Discussion
On Tue, 31 Dec 2024 at 06:41, Mark via NumPy-Discussion < numpy-discussion@python.org> wrote: > Hello all, > > > Many people have asked how to flatten a nested > I think this is out of scope for NumPy. Our bar for adding functionality is quite high. We are unlikely to consider generic routines th

[Numpy-discussion] Proposing a flattening functionality for deeply nested lists in NumPy

2024-12-30 Thread Mark via NumPy-Discussion
Hello all, Many people have asked how to flatten a nested list into a one-dimensional list (e.g., see this StackOverflow thread ). While flattening a 2D list is relatively straightforward, deeply nested

[Numpy-discussion] Re: surprising behavior from array indexing

2024-12-30 Thread Mark Harfouche via NumPy-Discussion
On Mon, Dec 30, 2024 at 1:51 PM Robert Kern wrote: > On Mon, Dec 30, 2024 at 10:28 AM Mark Harfouche via NumPy-Discussion < > numpy-discussion@python.org> wrote: > >> Happy new year everybody! >> >> I've been upgrading my code to start to support array indexing and in my >> tests I found somethin

[Numpy-discussion] Re: surprising behavior from array indexing

2024-12-30 Thread Robert Kern via NumPy-Discussion
On Mon, Dec 30, 2024 at 10:28 AM Mark Harfouche via NumPy-Discussion < numpy-discussion@python.org> wrote: > Happy new year everybody! > > I've been upgrading my code to start to support array indexing and in my > tests I found something that was well documented, but surprising to me. > > I've tri

[Numpy-discussion] surprising behavior from array indexing

2024-12-30 Thread Mark Harfouche via NumPy-Discussion
Happy new year everybody! I've been upgrading my code to start to support array indexing and in my tests I found something that was well documented, but surprising to me. I've tried to read through https://numpy.org/doc/stable/user/basics.indexing.html#combining-advanced-and-basic-indexing and ev