Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'attribute': 0.07; 'debugging': 0.07; 'error:': 0.07; 'url:github': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'wrote': 0.14; '8bit%:32': 0.16; 'skip:n 50': 0.16; 'cc:addr:python.org': 0.22; 'comparing': 0.24; 'removed.': 0.24; 'cc:2**0': 0.24; 'skip:" 30': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'getting': 0.31; 'file': 0.32; 'url:python': 0.33; '(most': 0.33; 'received:google.com': 0.35; '8bit%:9': 0.36; 'url:org': 0.36; 'skip:& 10': 0.38; 'skip:. 20': 0.38; 'url:library': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'most': 0.60; 'url:3': 0.61; 'to:addr:gmail.com': 0.65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=o0SsPlS/d5V5VqgkLXMjH+cuTFO//hL086aT6X1KheI=; b=xqX66DZ8BFpbRA8NjNBMAQm91Um2TGlIfCd4u434YdBETnlU7dNmBVK1F3s4KPJMD6 qEBRNOWnbRFKqidL1nA+XZs158HNvVJ7aqt81fawGITPxF3h+2JFylindAg2+8vbbnRO gxM80KzW+AoTxvKWeI8b4cGvgmtWhZn5KIetDeRb/ECr3dzJk/ewo84gfKhjTthBmQBt qaxzjcQeqHHMzFQyBMlTTKI2AdL3U/GyrMNu1OPNbn92NKqL7xrmSa3vz5SfHqdBFxrQ LzSnfraq0bzZdWbE6KzglS0thCkja38tsG/B6o5IP62LOhvE4fenxlX83Y/ua2myeiEz DvCw== MIME-Version: 1.0 X-Received: by 10.50.1.102 with SMTP id 6mr8566716igl.0.1383476108404; Sun, 03 Nov 2013 02:55:08 -0800 (PST) In-Reply-To: References: Date: Sun, 3 Nov 2013 03:55:08 -0700 Subject: Re: Debugging decorator From: Jason Friedman To: =?UTF-8?B?WWHFn2FyIEFyYWJhY8Sx?= Content-Type: multipart/alternative; boundary=047d7bd770a4ff2e8c04ea43a120 Cc: python-list 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: 58 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383476116 news.xs4all.nl 15923 [2001:888:2000:d::a6]:53564 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58387 --047d7bd770a4ff2e8c04ea43a120 Content-Type: text/plain; charset=UTF-8 > I wrote this decorator: https://gist.github.com/yasar11732/7163528 > > I ran it with Python 2 and thought it was neat. Most of my work is Python 3. I ran 2to3-3.3 against it and I am getting this error: $ ./simple.py Traceback (most recent call last): File "./simple.py", line 3, in @debugger.debugging File "/home/jason/python/debugger.py", line 41, in debugging new_function_body.append(make_print_node("function %s called" % func.__name__)) File "/home/jason/python/debugger.py", line 6, in make_print_node return ast.Print(dest=None, values=[ast.Str(s=s)], nl=True) AttributeError: 'module' object has no attribute 'Print' Comparing http://docs.python.org/2/library/ast.html#module-ast against http://docs.python.org/3.3/library/ast.html#module-ast I see that "Print" has indeed been removed. --047d7bd770a4ff2e8c04ea43a120 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

=
I wrote this decorator: https://gist.github.com/yasar11732/7163528

I = ran it with Python 2 and thought it was neat.
Most of my work is = Python 3.
I ran 2to3-3.3 against it and I am getting this error:<= /div>

$ ./simple.py=C2=A0
Traceback (most rece= nt call last):
=C2=A0 File "./simple.py", line 3, in &l= t;module>
=C2=A0 =C2=A0 @debugger.debugging
=C2=A0 F= ile "/home/jason/python/debugger.py", line 41, in debugging
=C2=A0 =C2=A0 new_function_body.append(make_print_node("function = %s called" % func.__name__))
=C2=A0 File "/home/jason/p= ython/debugger.py", line 6, in make_print_node
=C2=A0 =C2=A0= return ast.Print(dest=3DNone, values=3D[ast.Str(s=3Ds)], nl=3DTrue)
AttributeError: 'module' object has no attribute 'Print= 9;

Comparing=C2=A0http://docs.python.org/2/library/ast= .html#module-ast=C2=A0against=C2=A0http://docs.python.org/3.3/library/ast.html#= module-ast=C2=A0I see that "Print" has indeed been removed.
--047d7bd770a4ff2e8c04ea43a120--