1

Here is my code, I don't see any issue with this.

def test_methopd(async=False):
    pass

When I import the module I am getting following error.

$ python3 -c "import test"
 File "/Users/gaurang.shah/Documents/ctc/code/ci-cd-framework/atf/clients/test.py", line 1
    def test_methopd(async=False):
                         ^
SyntaxError: invalid syntax

The code works perfectly fine with Python 3.4.9 however gives error with Python 3.7.0

0

1 Answer 1

2

As of Python 3.7 async is a reserved word which cannot be used as an identifier (such as a parameter name)

PEP describing this change: https://www.python.org/dev/peps/pep-0492/#deprecation-plans

Depreciation Plans

async and await names will be softly deprecated in CPython 3.5 and 3.6. In 3.7 we will transform them to proper keywords.

This is also reflected in the online docs: https://docs.python.org/3/reference/lexical_analysis.html#keywords

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.