-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: is_list_like returns True even if __iter__ raises an error #54176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Would like to work on this issue |
A potential solution
|
If the caller uses |
Handling bespoke types in is_list_like comes up a lot and runs up against attempts to optimize this often-used function. I wonder if the solution is to move away from it in favor of a handful of explicitly supported types e.g. |
For context, I ran into this while trying to make |
take |
Updated to show fix to issue pandas-dev#54176
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
c_is_list_like
checksBut an object can override
__iter__
to raise andis_list_like
will still report that the object is TrueExpected Behavior
Installed Versions
Replace this line with the output of pd.show_versions()
The text was updated successfully, but these errors were encountered: