Skip to content

Use short type var names #2974

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

Closed
wants to merge 3 commits into from
Closed

Use short type var names #2974

wants to merge 3 commits into from

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented May 8, 2019

Closes #1872

def __cmp__(self, other: _AnyBuffer) -> bool: ...
def __init__(self, object: _ABT, offset: int = ..., size: int = ...) -> None: ...
def __add__(self, other: _ABT) -> str: ...
def __cmp__(self, other: _ABT) -> bool: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be just unions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I changed it to a union and changed the name back to be more expressive.

@JelleZijlstra
Copy link
Member

I'm not sure I agree with this. Short variable names are generally bad for readability and I don't know why typevars are special. For example, isn't _AnyStr2 clearer than _AS?

@srittau
Copy link
Collaborator Author

srittau commented May 8, 2019

@JelleZijlstra Personally, I agree. I prefer a solution like always appending _var, _co, and _contra or ending all TypeVars with T. But PEP 8 recommends something different at the moment. Maybe we should send this back to #1872 and possibly get the recommendation in PEP 8 changed?

@srittau
Copy link
Collaborator Author

srittau commented May 10, 2019

I am going to close this for now, until we decide what to do in #1872 .

@srittau srittau closed this May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Follow PEP 8 recommendations for type variable names
3 participants