Skip to content
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

Treat underscore variables as anonymous #3125

Closed
wants to merge 4 commits into from

Conversation

elazarg
Copy link
Contributor

@elazarg elazarg commented Apr 3, 2017

Fix #1639 #1649: allow (_, _) = (1, "")

There's no test for usage of underscores. I don't know how to define when and where this is legal (although pretty common in some frameworks)

(_, _) = (1.0, "")
for (_, _) in ((1, "a"), (2, "b")): pass

def f(_: int, _: str) -> None: pass
Copy link
Member

Choose a reason for hiding this comment

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

This actually gives SyntaxError: duplicate argument '_' in function definition at runtime (also in Python 2 with annotations removed).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops :) thanks!

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

I see few problems with this PR:

@elazarg
Copy link
Contributor Author

elazarg commented Apr 13, 2017

Thanks. I have fixed the issue reference.

@elazarg
Copy link
Contributor Author

elazarg commented Apr 13, 2017

There are some ideas in #1332. I will give it some thought.

@gvanrossum
Copy link
Member

Since we want to continue the usage of _ for gettext, this PR is probably the wrong approach -- shall we just close it until someone comes up with the right approach?

@elazarg
Copy link
Contributor Author

elazarg commented May 11, 2017

Ok.

@elazarg elazarg closed this May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants