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
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: arch...@mail-archive.com