New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NameError: name 'case' is not defined #30
Comments
Because MacroPy modifies the import process, you need to import macropy.core.macros (as in the REPL example in the readme) before you import specific macros. so
should work fine |
Thanks! Maybe adding that extra line to the examples would be useful. Or add a 'getting started' section, which includes all the necessary lines, so people who only want to spend 10 minutes trying out macropy (like me) only have to copy-paste a few lines and be instantly convinced to spend more time. Macropy looks like a great library, keep up the good work! |
It's already in the Rough Overview and Detailed Guide for the non-REPL macros; maybe I should add a reminder for those using the REPL |
A suggestion: people in a hurry scan for 'Getting Started', 'Quick start' and similar keywords. Starting the documentation with a small, documented REPL session showing case classes (and maybe a bit of pattern matching) should help. Or at least provide a link to such a document at the start of the README. Also, the 'Rough overview' starts by showing how to define macros. IMHO it's better to start with a few examples of using existing macros. Some people (e.g. me) will start by using the existing macros and later (if ever) be interested in defining their own. Thanks! |
Thanks for your suggestion; you are entirely right! I will find some time to shuffle it around. |
Made the top "banner" example into an executable REPL session, and linked to the examples which also have nice-to-use REPL sessions |
Hi everyone,
Any idea about what the problem might be? It seems like the macropy is never enabled because I also don't see that message.. |
It's not that you need import, you need to import the file with macros, not the macropy itself So if the file a.py contains macros, then you need to create b.py and import a. that's all. |
I installed macropy from git (git clone, python setup.py install).
I go to a python shell and try the case classes example.
I'm probably missing something obvious :-)
The text was updated successfully, but these errors were encountered: