On Sun, 20 Jun 2021 at 23:29, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:
>
> On 21/06/21 6:04 am, Sebastian Berg wrote:
> > * `flatten()` (alwasy copy)
> > * `ravel()` (copies if needed, and additionally ensures contiguity)
> > * `reshape(-1)` (copies if needed)
> >
> > They are all subtly different, unfortunately.
>
> There's also a .flat attribute, that returns a 1-d iterator!

There's also np.concatenate which to me seems like the closest to what
sum does with lists.

If there is a problem to solve here it's that people want to
concatenate things and reach out to the sum function because the
concatenate function doesn't exist. The sum function refuses to sum
strings but the preferred alternative is
    text = ''.join(strings)
which is just weird looking. Why would you call a method on the empty
string? It would be much better spelt as
    text = concatenate(strings)
and that spelling could work equally well for lists, tuples, etc.

-- 
Oscar
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/YFGGY4TDNHHEGJ2T5UED67W44SXRKNHA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to