Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'failing': 0.07; '[0,': 0.09; 'cc:addr:python-list': 0.11; '->': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'nose': 0.16; 'operates': 0.16; 'range(0,': 0.16; 'repl': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'wed,': 0.18; 'module': 0.19; '>>>': 0.22; 'import': 0.22; 'aug': 0.22; 'email addr:gmail.com>': 0.22; 'issue.': 0.22; 'cc:addr:python.org': 0.22; '>>>': 0.24; 'byte': 0.24; 'skip': 0.24; 'test.': 0.24; "haven't": 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'somewhere': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'raise': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'asked': 0.31; 'enabled': 0.31; 'trace': 0.31; 'there.': 0.32; 'level.': 0.33; 'something': 0.35; 'received:google.com': 0.35; 'google': 0.35; 'there': 0.35; 'activate': 0.36; 'doing': 0.36; 'unit': 0.37; 'skip:& 10': 0.38; 'sum': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; '20,': 0.68 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=p/CcHTNgedNlgp3NgBpW3IZz99x7UqpLSOo3iCpU8wY=; b=ATO4OpQUWU4iJ+uTZaK25NQlPC36IIfXBeeykWmVUxgdU6XSliSendrPpQX0+Sl4rW biIqjY1prO39hDTdZsMURnE4oY9PsQ47qtrjp6NtBen9Ax4Ol1BEfJW5tBTfTg6dBja9 NN13ANT2nt0k3LRJrUQ2vAULrBOhzE2HG2k6KMML1Uzg/jCdbPWNIqGD/dAdbPGTcjKW lM0MA8OPbK352w7dcXr6v9/dFRQsby4f7LvuZYtjb/5zrjK/Bl4/VzJIMg9T5srWBXw0 WwfqoTahvE2krYh+2cLIgpu+Z68iIEKBaswl8N/r81U+LPnYkw6x3xPizac3aZHMpNjb D0QA== MIME-Version: 1.0 X-Received: by 10.50.33.73 with SMTP id p9mr12867143igi.24.1408543101518; Wed, 20 Aug 2014 06:58:21 -0700 (PDT) Sender: skip.montanaro@gmail.com In-Reply-To: References: Date: Wed, 20 Aug 2014 08:58:21 -0500 X-Google-Sender-Auth: 0y9MwRqkd7s28L-d5OIjvV2l_e8 Subject: Re: MacroPy tracing not working for me... From: Skip Montanaro To: Chris Angelico Content-Type: multipart/alternative; boundary=089e01538e5a3788e405010fffd9 Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 91 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408543110 news.xs4all.nl 2918 [2001:888:2000:d::a6]:51910 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76663 --089e01538e5a3788e405010fffd9 Content-Type: text/plain; charset=UTF-8 On Wed, Aug 20, 2014 at 7:03 AM, Chris Angelico 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 --089e01538e5a3788e405010fffd9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= 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 t= o activate it. In particular, it doesn't appear-to-operate on a less-th= an-module level. Since it operates on the AST, it has to be active during b= yte compilation. At the REPL you can import macropy.console to achieve the = necessary activation:

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

Still haven't figured out whe= re to import macropy.activate when I just want to trace a single function i= n a larger program. I wanted to trace the execution of a single failing uni= t test. It looks like I will have to import the macropy.activate module som= ewhere at the top level. Perhaps I can coax nose into doing that for me.

Skip

--089e01538e5a3788e405010fffd9--