Skip to content

Misleading error for ((a) := 1) #138294

@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

>>> ((a) := 1)
  File "<python-input-0>", line 1
    ((a) := 1)
      ^
SyntaxError: cannot use assignment expressions with name

Of course, it can. You only need to remove parentheses around the name.

>>> (a := 1)
1

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-parsertype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions