Created
May 8, 2013 20:45
-
-
Save ducky427/5543518 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from macropy.macros.string_interp import macros, s | |
a, b = 1, 2 | |
c = s%"%{a} apple and %{b} bananas" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: unsupported operand type(s) for %: 'NoneType' and 'str' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can't use macros in a single file. You need to import macropy before you import your code which uses macro substitution. So in this example, you would need a main.py which looks like
You can look at run.py to see how we run our unittests.