BUG: Fix regression in is_list_like
State: closed

`is_list_like()` used to use `isinstance(obj, abc.Iterable)` before #39852 where it was optimized for performance. This resulted in a regression where objects that explicitly declare `__iter__` as `None` are considered "list like" but not instances of `abc.Iterable`.

Because the original original PR was focused on performance, here are the same timeit cases run on this PR:

```python
In[1]: import numpy as np
In[2]: from pandas._libs.lib import is_list_like
In[3]: arr = np.array(0)
In[4]: arr2 = np.array([0])

In[5]: %timeit is_list_like([])
51.3 ns ± 0.231 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)  <- master
56.3 ns ± 0.44 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)   <- PR
153 ns ± 2.4 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)     <- isinstance(obj, abc.Iterable)

In[6]: %timeit is_list_like(0)
117 ns ± 2.19 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)    <- master
126 ns ± 2 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)       <- PR
154 ns ± 1.18 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)    <- isinstance(obj, abc.Iterable)

In[7]: %timeit is_list_like(arr)
49.5 ns ± 0.156 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)  <- master
50.6 ns ± 0.14 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)   <- PR
152 ns ± 1.12 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)    <- isinstance(obj, abc.Iterable)

In[8]: %timeit is_list_like(arr2)
50.8 ns ± 1.36 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)   <- master
51.5 ns ± 0.179 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)  <- PR
151 ns ± 0.582 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)   <- isinstance(obj, abc.Iterable)
```

- [ ] tests added / passed
- [ ] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [ ] whatsnew entry


Labels:
name: Compat
description: pandas objects compatability with Numpy or Python functions

Comments:
no objection, ping on green (you can add a release not if you'd like), 1.4.
> no objection, ping on green (you can add a release not if you'd like), 1.4.

Where do you think the best place to put the release note is? doc/sources/whatsnew/v1.4.0rst -> Bug Fixes -> Other?
> Bug Fixes -> Other?

That's fine, yes.
Shouldn't we backport is its a regression?
-0 on backporting. its no big deal to do, but i think this is a very minor case. @phofl do you feel strongly here?
No, just wanted to avoid that it gets missed 
ok let's do it.

@aiudirog can you add a note to 1.3.3 regression section.
Will do, I'll take care of it later tonight.
Issue #42549 is related, but not the same as this issue: `is_list_like` also fails to detect `__getitem__` implemented without `__iter__`. IMO solving that should require a different PR because it isn't a regression as `isinstance(obj, abc.Iterable)` doesn't detect those either, [explicitly](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable).
thanks @aiudirog 
@meeseeksdev backport 1.3.x
Something went wrong ... Please have  a look at my logs.