Skip to content

Walruses aren't allowed in places where they should be #820

Closed

Description

@kg583

The following walruses raise parser errors, despite being valid Python:

[1, 2, 3][i := 0]
sum(i := 0 for _ in [1, 2, 3]) 

Note that the former only happens in a __getitem__ call; a literal like [i := 0] is parsed correctly.

Activity

  1. added this to the v3.1.0 milestone on Jan 18, 2024
  2. added a commit that references this issue on Jan 18, 2024
    17ff2a3
  3. evhub commented on Jan 18, 2024

    @evhub
    Owner

    Ah, looks like I missed one of the places where 3.10 added support for named expressions. Simple workaround is to add parentheses as in <=3.9, but this should now work with --target 3.10+ as of coconut-develop>=3.0.4-post_dev15.

  4. added a commit that references this issue on Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions