Skip to content

Tricky SyntaxErrors #1

Closed
Closed
@MostAwesomeDude

Description

@MostAwesomeDude

These are some of my treasures, discovered while implementing a Python parser years ago.

First, the "surprising comma."

Codepad: http://codepad.org/JiFQi7vr

def f(**args, **kwargs):
 print args, kwargs

def args = 5, 7
f(42, *args,)

Technically only f(*args,) or f(**kwargs,) is needed to tickle this one.

Second, the "not knot."

Codepad: http://codepad.org/IA7k5jEg

x = True
y = False

print not x == y
print x == not y

Again, a smaller test case, like x == not y, will provoke it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions