Skip to content
Rust-like sum types for Python
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
pysum.py

README.md

pysum

Rust-like sum types for Python

from pysum import enum

Token = enum('''
    Cond(3 cond conseq alt)
    OpenParen
    ClosePare
    Sep
    OpenBrace
    CloseBrace
''')

print(Token.Cond('x == 5', 'x = 3', 'x = 5'))

It is important to note that commas are unnecessary and are ignored by the lexer.

You can’t perform that action at this time.