Skip to content

BUG: iter(ser.str) did not raise TypeError #54174

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

Merged
merged 7 commits into from
Jul 24, 2023

Conversation

mroeschke
Copy link
Member

@mroeschke mroeschke commented Jul 18, 2023

@mroeschke mroeschke added the Strings String extension data type and string data label Jul 18, 2023
@@ -243,6 +243,9 @@ def __getitem__(self, key):
result = self._data.array._str_getitem(key)
return self._wrap_result(result)

def __iter__(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__iter__: ClassVar[None] # type: ignore[assignment] could potentially help type checkers (I didn't try it) or using def __iter__(self) -> NoReturn:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this passes the is_list_like test, this appears not to completely address iter(ser.str) raising because iter still works because __getitem__ is defined

@mroeschke mroeschke added this to the 2.1 milestone Jul 19, 2023
@mroeschke
Copy link
Member Author

Looks like tests are passing here so merging. Happy to follow up if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: iter(Series.str) does not raise a TypeError
2 participants