On Wed, Aug 20, 2014 at 7:03 AM, Chris Angelico <ros...@gmail.com> wrote:

> Sounds like something to raise as an issue.


I found the macropy Google Group and asked there. There is more to do to
activate it. In particular, it doesn't appear-to-operate on a
less-than-module level. Since it operates on the AST, it has to be active
during byte compilation. At the REPL you can import macropy.console to
achieve the necessary activation:

>>> import macropy.console
0=[]=====> MacroPy Enabled <=====[]=0
>>> from macropy.tracing import macros, trace
>>> with trace:
...   sum = 0
...   for i in range(0, 5):
...     sum = sum + 5
...
sum = 0
for i in range(0, 5):
  sum = sum + 5
range(0, 5) -> [0, 1, 2, 3, 4]
sum = sum + 5
sum + 5 -> 5
sum = sum + 5
sum + 5 -> 10
sum = sum + 5
sum + 5 -> 15
sum = sum + 5
sum + 5 -> 20
sum = sum + 5
sum + 5 -> 25

Still haven't figured out where to import macropy.activate when I just want
to trace a single function in a larger program. I wanted to trace the
execution of a single failing unit test. It looks like I will have to
import the macropy.activate module somewhere at the top level. Perhaps I
can coax nose into doing that for me.

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to