-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Copy typechecker-internal symbols to _typeshed._type_checker_internals
#13816
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
Also, considering that this module itself is private, we should use consistent naming. I suggest to also add |
What about |
I'm not sure what would work best for type checkers. Avoiding a name conflict would be great, of course. |
For red-knot, I would prefer an unambiguous name such as |
I've converted this PR to a draft for at least a week to give us a chance to discuss it. I've also updated it to reflect the current consensus, which I've also listed in the initial comment on this PR. |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This comment has been minimized.
This comment has been minimized.
Is it worth using the
|
I don't think |
Could we name the module more descriptively? Something like |
I don't like overly long module names, but I've gone with |
This comment has been minimized.
This comment has been minimized.
I'm not super happy with While I agree about module names in general because they need to be typed many times, I don't think it applies here. Can you give a concrete reason why this shouldn't be |
I honestly doubt that as there is a comment at the very top of the file explaining it. I don't remember any questions about other modules here, either.
I prefer module names to be short and succinct to match the general Python style. For example, looking at |
I still think a longer name would be better, but I'm fine with using a short name because of a comment. There has been confusion about I think this would benefit from a long file name because it is so special. If someone stumbles into this file, a good name immediately explains what the thing is, while a name that includes |
+1 what Akuli said. My 2 cents: In a day and age where horizontal space isn't sparse, I prefer clear names over potentially vague abbreviations. The more clearly the name says (whilst staying somewhat concise) "this is internal implementation detail, don't use this" to end-users and library maintainers, the better.
But I also won't die on this hill if |
_typeshed._tc
_typeshed._type_checker_internals
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Summary: These are fake classes that typeshed maintains to help out type checkers. Rename them and add doc comments to make that clear. The "fallback" naming is borrowed from here: python/typeshed#13816 (comment). Reviewed By: ndmitchell Differential Revision: D73292305 fbshipit-source-id: f0da37429017fc740cd6e76be659ccbbfc8c3b3a
Since there were no further comments, I think this is ready for merging. |
Cf. #7580
Current changes:
builtins.function
: No changes for now, will be removed soon in favor oftypes.FunctionType
builtins.ellipsis
: No changes for now, will be removed after support for Python 3.9 is dropped in favor oftypes.EllipsisType
typing._promote
→_typeshed._tc.promote
typing._TypedDict
→_typeshed._tc.TypedDictFallback
typing.AwaitableGenerator
→_typeshed._tc.AwaitableGenerator
typing.NamedTuple
→_typeshed._tc.NamedTupleFallback