8000 Use == instead of = for equality checking in pattern-matching · Issue #365 · evhub/coconut · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Use == instead of = for equality checking in pattern-matching #365
Closed
@ArneBachmann

Description

@ArneBachmann

I finally managed to write a match clause

          match None in reso:
            pass
          match =ConflictResolution.MINE in reso:
            pass
          match =ConflictResolution.THEIRS in reso:
            pass
          match =ConflictResolution.NEXT in reso:
            pass

it seems to work, but the syntax for comparison seems odd... it should be == not =.
My initial confusion was how to refer to the "in" expression inside the match expression. There is no it defined. The =X syntax looks more like an assignment though, quite unpythonic.

Am I seeing this wrong?
Also, how would I check membership? match "1".in in expr?

The documentation is leaving lots of questions and lacks good examples, imho.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0