forked from ceridwen/macropy
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
It would be convenient if a block macro could return, when appropriate for some particular use case, just a single AST node as the transformed body. Currently the return type from a block macro must be list.
A real use case for this is the autocurry macro in unpythonic. (Usage, implementation.)
Minimal (non-)working example:
main.py:
from mwe import macros, mwe
with mwe:
print("hi")
print("ho")mwe.py:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from macropy.core.macros import Macros
macros = Macros()
@macros.block
def mwe(tree, **kw):
return tree[0] # return just one AST node --> crash[edit] update link.
[edit] update doc link.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels