I have a function that utilizes both a default parameter and *args:

def greeting(name, *args, exclamation='yo!'):
    for arg in args:
        print(name, arg, exclamation)

This seems to work fine. However, when I check it with flake8, it returns:

1 col 38| E901 SyntaxError: invalid syntax

I am stickler for both following correct practice and having my checks clear. Am I doing this wrong? Is a different method standard?

有帮助吗?

解决方案

As iCodez guessed, this was the result of unintentionally using a version of flake8 designed for Python 2.x. Installing the Python 3 version with sudo pip-3.2 install flake8 solved the problem.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top