On Wed, Nov 30, 2022 at 10:24 AM Matti Picus <matti.pi...@gmail.com> wrote:

>
> On 30/11/22 05:47, Stefan van der Walt wrote:
> > On Tue, Nov 29, 2022, at 07:21, i...@markopacak.com wrote:
> >> The debate is whether np.testing.asset_equal should support
> >> collections.Sequence objects.
> > assert list(sequence1) == list(sequence2)
> >
> > should do the trick, and also handles int vs float and nan comparisons.
> >
> >> What is the general view on adding support in testing for Sequence
> objects?
> > If it's a straightforward change that doesn't impact the NumPy test
> suite, it's probably fine. Let's see what the others say.
> >
> > Stéfan
>
>
> Apparently nothing is really straightforward. On the issue there is
> discussion of problems this causes when comparing strings (and how the
> naive implementation breaks lots of tests), and this comment [0] from a
> Pandas maintainer
>
>  > If you do go down this path, take a look at
> pandas._libs.lib.is_list_like. I've found it to be a minor PITA to
> accommodate every corner case that users ask to consider listlike
>

I agree with Matti, this tends to lead to quite a bit of work and dealing
with corner cases, for little gain. We should move away from supporting
non-array inputs, not allow more.

I'd prefer to tell users to use `np.asarray()` on their inputs instead.

Cheers,
Ralf



>
>
> Matti
>
> [0] https://github.com/numpy/numpy/issues/22569#issuecomment-1331586018
>
> _______________________________________________
> NumPy-Discussion mailing list -- numpy-discussion@python.org
> To unsubscribe send an email to numpy-discussion-le...@python.org
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: ralf.gomm...@gmail.com
>
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to