Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76663
| References | <CANc-5UwMj5-qvJ9qvXbJYmGPMH=p5RO2Bt98Y8aia5ce=ke5RQ@mail.gmail.com> <CAPTjJmpP2QP1Gbyj1M-EqoChiXbzOy=kTB5uLfMn4Tn9ePPOYg@mail.gmail.com> |
|---|---|
| Date | 2014-08-20 08:58 -0500 |
| Subject | Re: MacroPy tracing not working for me... |
| From | Skip Montanaro <skip@pobox.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13207.1408543110.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On Wed, Aug 20, 2014 at 7:03 AM, Chris Angelico <rosuav@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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: MacroPy tracing not working for me... Skip Montanaro <skip@pobox.com> - 2014-08-20 08:58 -0500
csiph-web