Skip to content

Allow subtypes of List[Scalar] by introducing ScalarArg #124

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 4 commits into from
Jul 10, 2022

Conversation

Dr-Irv
Copy link
Collaborator

@Dr-Irv Dr-Irv commented Jul 10, 2022

@Dr-Irv Dr-Irv requested review from bashtage and twoertwein July 10, 2022 02:17
@@ -122,6 +122,7 @@ Scalar = Union[
Timestamp,
Timedelta,
]
ScalarArg = TypeVar("ScalarArg", bound=Scalar)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe ScalarT to emphasize that it is a TypeVar.

Even though _typing.py is private, it might be good to make all variables that are not actually in pandas explicitly private. Users might want to import some of the type variables from pandas to annotate their own code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe ScalarT to emphasize that it is a TypeVar.

Good idea. Done in next commit.

Even though _typing.py is private, it might be good to make all variables that are not actually in pandas explicitly private. Users might want to import some of the type variables from pandas to annotate their own code.

That could be something we do in the future. One thing I would like to do is reconcile the things in pandas._typing.py and pandas-stubs._typing.pyi, because there are some inconsistencies. Created #128

@Dr-Irv Dr-Irv requested a review from twoertwein July 10, 2022 16:44
@Dr-Irv
Copy link
Collaborator Author

Dr-Irv commented Jul 10, 2022

@twoertwein once this is approved and merged, I'm going to do a new release.

@twoertwein twoertwein merged commit d2f3264 into pandas-dev:main Jul 10, 2022
@twoertwein
Copy link
Member

Thank you @Dr-Irv !

@Dr-Irv Dr-Irv deleted the issue97 branch December 28, 2022 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Overloads for accessing columns of a DataFrame are too restrictive
2 participants