Conversation
b48308e to
4a1612b
Compare
4a1612b to
5d2c034
Compare
Member
|
Can you explain why these overloads are necessary? In particular, why is the Generic necessary? What is the difference between accepting a |
Contributor
Author
With generic: command: Command = ...
install_lib_command: install_lib = ...
reinitialized_command = command.reinitialize_command(install_lib_command)
# Mypy: Revealed type is "distutils.command.install_lib.install_lib"
# Pyright: Type of "reinitialized_command" is "install_lib"
reveal_type(reinitialized_command)Without generic: command: Command = ...
install_lib_command: install_lib = ...
reinitialized_command = command.reinitialize_command(install_lib_command)
# Mypy: Revealed type is "distutils.cmd.Command"
# Pyright: Type of "reinitialized_command" is "Command"
reveal_type(reinitialized_command)The generic allows consumers of this method to not loose on type specificity. Otherwise you'd have to |
5d2c034 to
16dbe11
Compare
16dbe11 to
2017969
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a part of adding typeshed's typevars to setuptools, but this change is better handled on distutils' side rather than adding typing-only overloaded overrides in setuptools.
This won't have any effect outside this repo and pypa/setuptools#4704 until pypa/setuptools#4689 , but it also shouldn't have any negative effect by itself.