-
-
Notifications
You must be signed in to change notification settings - Fork 143
WIP: Use default
in TypeVar
so Series
defaults to Series[Any]
, and Index
to Index[Any]
#1232
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
base: main
Are you sure you want to change the base?
Conversation
1a6dbd7
to
f63956a
Compare
default
in TypeVar
so Series
defaults to Series[Any]
, and Index
to Index[Any]
default
in TypeVar
so Series
defaults to Series[Any]
, and Index
to Index[Any]
I'm fine with this. Need to run |
cool, thanks! there's a couple of test failures I haven't figured out, will investigate
|
b0d5713
to
e67aaa9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK so far.
@@ -168,7 +168,7 @@ class SeriesGroupBy(GroupBy[Series[S1]], Generic[S1, ByT]): | |||
self, | |||
) -> Iterator[tuple[ByT, Series[S1]]]: ... | |||
|
|||
_TT = TypeVar("_TT", bound=Literal[True, False]) | |||
_TT = TypeVar("_TT", bound=Literal[True, False], default=Literal[True]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit surprised that you didn't have to change the import
of TypeVar
to come from typing_extensions
here since you are using the default
feature.
i think there might be an issue with mypy here, have reported python/mypy#19182 |
bit of an experiment
closes #1133
I saw that NumPy follow this pattern, for example here:
https://github.com/numpy/numpy/blob/3363b38d99f87601869c2c9d68c2b16e54509675/numpy/__init__.pyi#L788-L792
and they import
TypeVar
fromtyping_extensions
(which is a dependency of mypy anyway)This would close 1133 for free, and I think improve ergonomics