Questions tagged [macropy]

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.

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.

3 questions
37
votes
7 answers

Adding Macros to Python

I would like to invoke the following code in-situ wherever I refer to MY_MACRO in my code below. # MY_MACRO frameinfo = getframeinfo(currentframe()) msg = 'We are on file ' + frameinfo.filename + ' and line ' + str(frameinfo.lineno) # Assumes…
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
3
votes
1 answer

MacroPy installation fails

Trying to install MacroPy with pip on Python 3.4.3, but I get an arror: $ pip3 install MacroPy Collecting MacroPy Downloading MacroPy-1.0.3.zip Complete output from command python setup.py egg_info: Traceback (most recent call last): …
fferri
  • 18,285
  • 5
  • 46
  • 95
2
votes
5 answers

Macros in python

in my project I have to repeat often such part of code: class SimplePhysicObject(Object): def __init__(self): super(Object, self).__init__('SimplePhysicObject') But instead of SimplePhysicObject there is new string each time. Are there…
Max Frai
  • 61,946
  • 78
  • 197
  • 306