◐ Shell
reader mode source ↗
Skip to content

bpo-35207: Disallow expressions like (a) = 42#10444

Closed
pablogsal wants to merge 1 commit into
python:masterfrom
pablogsal:bpo-35207
Closed

bpo-35207: Disallow expressions like (a) = 42#10444
pablogsal wants to merge 1 commit into
python:masterfrom
pablogsal:bpo-35207

Conversation

@pablogsal

@pablogsal pablogsal commented Nov 10, 2018

Copy link
Copy Markdown
Member

As commented initially in bpo-33878, the fact that expressions like
(x) = 42 are accepted is, in reality, an implementation detail and
they should be disallowed.

I am not sure if this is the cleanest/simplest implementation...if you think there is a better way to do this I am happy to change the Pull Request :)

https://bugs.python.org/issue35207

As commented initially in bpo-33878, the fact that expressions like
(x) = 42 are accepted is, in reality, an implementation detail and
they should be disallowed.
@pablogsal

pablogsal commented Nov 10, 2018

Copy link
Copy Markdown
Member Author

I am not sure what to do with the annotated assignment as in test_grammar there are these uses:

exec('X: int; Z: str = "Z"; (w): complex = 1j', ns)
def f2bad():
    (no_such_global): int
    print(no_such_global)

@gvanrossum

Copy link
Copy Markdown
Member

We should not do this. See the issue.

@gvanrossum gvanrossum closed this Nov 11, 2018
@pablogsal pablogsal deleted the bpo-35207 branch May 19, 2021 18:57
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.

4 participants