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

bpo-39702: Relax grammar restrictions on decorators (PEP 614). #18570

Merged
merged 13 commits into from Mar 3, 2020

Conversation

@brandtbucher
Copy link
Member

@brandtbucher brandtbucher commented Feb 20, 2020

Marking as DO-NOT-MERGE until the PEP passes, but code review is still appreciated. Discussion of semantics should go to the Python-Dev thread for the PEP.

https://bugs.python.org/issue39702

@jimbaker

This comment has been minimized.

Copy link

@jimbaker jimbaker commented on Lib/test/test_decorators.py in a994a39 Feb 14, 2020

Nice reduction in general for the code.

I do suggest that you test the corresponding impact of this relaxation, if only to show positive examples as in the proposed PEP as well as where some errors go from SyntaxError to TypeError. For example:

>>> @True                                                                                                                                            .
... def f(a): return a*2
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
TypeError: 'bool' object is not callable

This comment has been minimized.

Copy link
Owner Author

@brandtbucher brandtbucher replied Feb 14, 2020

Thanks, good suggestion.

I consciously decided to hold off on adding additional code (including tests for the parser and other parts of the interpreter) until after the first couple of rounds of review. Now that the design has stabilized, I'm moving forward with adding tests and generally trying to break this thing for a day or two. 😉

Copy link
Member

@gvanrossum gvanrossum left a comment

Amazing!

Can’t wait to see what creative use people are going to make of the walrus here... :-)

@brandtbucher
Copy link
Member Author

@brandtbucher brandtbucher commented Mar 3, 2020

PEP 614 has been accepted!

@gvanrossum gvanrossum merged commit be501ca into python:master Mar 3, 2020
9 checks passed
9 checks passed
Docs
Details
Windows (x86)
Details
Windows (x64)
Details
macOS
Details
Ubuntu
Details
Azure Pipelines PR #20200221.1 succeeded
Details
bedevere/issue-number Issue number 39702 found
Details
bedevere/news News entry found in Misc/NEWS.d
continuous-integration/travis-ci/pr The Travis CI build passed
Details
gmelikov added a commit to gmelikov/cpython that referenced this pull request Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.