You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that we have Type[C] in PEP 484, many places where stubs currently use type they can be more precise. E.g. if an argument must be an exception class, Type[BaseException] is more appropriate.
This would be an easy task (but don't do many unrelated modules in one big PR -- small PRs are much easier to review and merge and don't get stale as quickly).
I wonder whether we should replace all "naked" type statements with Type[Any] (or type[Any] when PEP 585 gets implemented). This forces the contributor to actively think about the generic type to use. We could enforce this using a linter in the future.
Most usages of type in typeshed now look legitimate (they are used in places where all types are accepted). We can make more improvements in specific cases but I don't think we still need this issue.
Activity
Require warning categories to be subclasses of Warning (python#343)
Require warning categories to be subclasses of Warning (#343)
srittau commentedon Sep 11, 2018
A casual grep showed that not too many of these instances are left in typeshed.
JelleZijlstra commentedon Jun 28, 2020
I found the following that looked like they could be made more specific (from
git grep ': type\b'):srittau commentedon Sep 17, 2020
I wonder whether we should replace all "naked"
typestatements withType[Any](ortype[Any]when PEP 585 gets implemented). This forces the contributor to actively think about the generic type to use. We could enforce this using a linter in the future.JelleZijlstra commentedon Dec 16, 2021
Most usages of
typein typeshed now look legitimate (they are used in places where all types are accepted). We can make more improvements in specific cases but I don't think we still need this issue.Prepare release 4.10.0 (python#343)