Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MYPY-137: Disallow assignment to None, False, True and __debug__ #728

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 1 commit into from

Conversation

i80and
Copy link
Contributor

@i80and i80and commented Jul 26, 2015

Not sure that this is architecturally the "best" solution; open to feedback on how else to structure it.

Solves #137

@o11c
Copy link
Contributor

o11c commented Jul 26, 2015

This is going to be obsoleted as a side effect of the new parser that I'm working on (for column tracking and much better diagnostic reporting and control).

I've actually already pushed the lexer part (which treats them as keywords), but I haven't done the parser yet and it's thinkable that I might have to change what I've written so far.

Curiously, __debug__ is not like the other three - it is allowed to be read as a member:

ben@joyplim ~ % python3
2015-07-25 21:42:23-07:00
Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import builtins
>>> builtins.__debug__
True
>>> builtins.None
  File "<stdin>", line 1
    builtins.None
                ^
SyntaxError: invalid syntax

@i80and
Copy link
Contributor Author

i80and commented Jul 26, 2015

Ah, that's great! I'll just close this then.

@i80and i80and closed this Jul 26, 2015
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