Skip to content

Update PY3 cheat sheet with varargs example. #3201

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

Merged
merged 2 commits into from
Apr 21, 2017
Merged

Conversation

gvanrossum
Copy link
Member

Also remove an extraneous blank line from the PY2 sheet.

(This was added for PY2 in #2524 but forgotten for PY3.)

Also remove an extraneous blank line from the PY2 sheet.
# This is how to deal with varargs.
# This makes each positional arg and each keyword arg a 'str'.
def call(self, *args, **kwargs):
# type: (*str, **str) -> str
Copy link
Member

@ilevkivskyi ilevkivskyi Apr 20, 2017

Choose a reason for hiding this comment

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

Why not just:

def call(self, *args: str, **kwargs: str) -> str:
    ...

This seems to work equally well. Aren't we supposed to use Python 3 idioms/syntax in Python 3 cheat sheet?

Copy link
Member Author

Choose a reason for hiding this comment

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

That had occurred to me too after pushing this, and through some fat-fingering I didn't push the fix. Now I have.

@gvanrossum gvanrossum merged commit 8facb82 into master Apr 21, 2017
@gvanrossum gvanrossum deleted the py3-cheat-sheet-update branch April 21, 2017 17:25
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.

2 participants