-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Follow PEP 8 recommendations for type variable names #1872
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
Comments
Agreed, go ahead. |
This seems to come up most often with self-types, where we need a per-class typevar like So as an alternative, I propose that typevar names should always end in |
I just quickly grepped the typeshed sources and this only affects ~20 definitions. |
This appeared in #1856
The problem is that type variable names in some stubs don't follow PEP 8 that recommends short names. This recommendation exists for a reason: behaviour of some constructs is subtly different with type variables and normal types, so it should be immediately clear that a given name refers to a type variable. Most notable examples are generic base classes and generic type aliases, where this leads to false negatives (unless
--disallow-any-generics
is used):(it is not something hypothetic, I have seen this kind of errors many times)
I propose to replace the existing long type variable names to follow PEP 8 style. If someone really doesn't like short names, we could propose some other agreement, like end long type variable names with
_TVar
.The text was updated successfully, but these errors were encountered: