Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix
pyqtSlot
result
parameter type andCallable
generic #102fix
pyqtSlot
result
parameter type andCallable
generic #102Changes from 3 commits
b95169d
7c86c3c
383e4f9
588c8c7
4516100
93576bb
1a65b22
0d9fd8c
097218f
bf51e07
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
How do you feel about the
typing.Type[object]
. I starting withType
because I was trying to relate it to the function return type but... I didn't get that working. Maybe this should just beobject
/Any
?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.
Could
FuncT
be made generic? I think this would workHowever, looking at the docs:
Not sure how the C++ string would interact with this. Maybe
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.
Just noticed that
types
has the same comment in the docs about "may be a Python type object or a string", so maybe we can be more specific thantyping.Any
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.
Did you mean "can't be more specific"? When I read this I thought you made a comment then backed away from it. I did make an effort to relate the
result
parameter to the return type of thetyping.Callable
parameter and return but failed. I could make another attempt for you to look at.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.
No those were two different comments. I was suggesting that we change
result
to use a generic. Then I noticed thattypes
is documented in a similar fashion and remarked that we could maybe do better than its currenttyping.Any
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.
For the
types
, they can be any types including user defined and they don't necessarily even inherit from type what with metatypes, right? (plusstr
) So the only thing I can think of is to try to relate it with the parameters of the wrapped callable, but mypy doesn't do that yet. There's some related PEP but I can't find it at the moment. Do you have something specific in mind here?I'll try what you shared though it looks familiar.
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.
Yeah you're probably right that
types
is as good as mypy currently allowsThere 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.
Here's yours along with the existing and a
Protocol
attempt.https://mypy-play.net/?mypy=latest&python=3.8&gist=314620351fccbbfd297833d345b40a6d
I don't think we get to make a generic typevar.
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.
Is there a reason we need to make
FuncT
a TypeVar?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.
You win (I think), thanks.