-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
Issue1098 #1172
base: main
Are you sure you want to change the base?
Issue1098 #1172
Conversation
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.
This won't work. Consider this example:
s = pd.Series([1, 2, 3])
c = 1.2
reveal_type(s + c)
The revealed type with your change will be Series[complex]
. The reason is that the first overload doesn't get matched because the type of the Series
is Series[S1]
, and the first overload requires the scalar to be of the same type S1
. So with your change, you get Series[complex]
, because it now matches the second overload, because the float value of 1.2 gets matched to the complex
argument.
To get this to work, you have to consider ALL the possible combinations, and get the overloads in the right order. This is non-trivial.
I changed it and placed all in right order but typechecking for pyright failed code:
logs:
|
It's OK to add You should look at the PR #1093 to see what was attempted. @loicdiridollou can say more. This is VERY hard to get right. |
Indeed, the big trick here is how to manage the UnknownSeries. It was introduced as a super type of Series[Any] recently and it may help unlock some of the possibilities. |
This PR addresses issue #1098. I have fixed the add method and included a test case for it. However, I'm facing some challenges resolving the mul method due to conflicts with other test cases that are causing failures. If you permit me to modify or remove some of these test cases, I can work on fixing the issue in a separate PR.