Tag Archives: MacroPy

Macros in Python: quasiquotes, case classes, LINQ and more!

via lihaoyi/macropy · GitHub.

MacroPy is an implementation of Syntactic Macros in the Python Programming Language. MacroPy provides a mechanism for user-defined functions (macros) to perform transformations on the abstract syntax tree (AST) of a Python program at import time. This is an easy way to enhance the semantics of a Python program in ways which are otherwise impossible, for example providing an extremely concise way of declaring classes: