Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!cs.uu.nl!news.stack.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'explicitly': 0.05; 'developer.': 0.07; 'element': 0.07; '2to3': 0.09; 'function,': 0.09; 'oh,': 0.09; 'python': 0.11; '2.7': 0.14; '"from': 0.16; '__future__': 0.16; 'ast': 0.16; 'expert,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'newline,': 0.16; 'node.': 0.16; 'op.': 0.16; 'there?': 0.16; 'language': 0.16; 'wrote:': 0.18; '(not': 0.18; 'obviously': 0.18; 'import': 0.22; 'print': 0.22; "shouldn't": 0.24; 'mon,': 0.24; 'primary': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'probably': 0.32; 'used,': 0.33; 'noticed': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'too': 0.37; 'nov': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'simple': 0.61; "you're": 0.61; 'special': 0.74; 'demand': 0.91; '2013': 0.98 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 :content-type; bh=eY3d02W2UxrfmuVvhtJLaGKUVOiIBhGDbKFt9RkkByo=; b=FyMO7ZY5RpBddufcSBQpDXpQyTxnbvBHTkQsLEWqGzdowQArCsOiVgvjKUGFcSxT2x qoaBY/E9rHKtkhvOBVJw6f+wpGe3rKMOjGa2VU1EtVnVZB5lzMwj1Fgj7eh5Shz4fKdv Ltul742B0oUrvI3vsy622txcP3dHPkh1dRbGSBb7wIfPstdz3bknJ/UGoFT4+7/l0UwS SDD1eaxpBl6+nfvIHzsf7FNGV8hQ7SZIgm/TngN5kuee6o7fsGnA3RgUeh8V3U2e/LDz x4VIKEWHRr0zZKlMXTXKbhnDExwwK4wzdEKbaB5nUebj7sUzuY0i/hTO5CnNv9VPrPyD DU0Q== MIME-Version: 1.0 X-Received: by 10.66.26.236 with SMTP id o12mr1364427pag.136.1383484928712; Sun, 03 Nov 2013 05:22:08 -0800 (PST) In-Reply-To: References: Date: Mon, 4 Nov 2013 00:22:08 +1100 Subject: Re: Debugging decorator From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383484938 news.xs4all.nl 15980 [2001:888:2000:d::a6]:60626 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58396 On Mon, Nov 4, 2013 at 12:20 AM, Chris Angelico wrote: > As print is now a function, you're going to need to construct a > function call element instead of a special 'print' node. I don't know > how to do that as I'm not an AST expert, but hopefully you can work it > out from there? > > If you need it to be cross-version, you could probably use > sys.stdout.write explicitly (not forgetting to add a newline, which > print does and write - obviously - doesn't). Or just demand that "from > __future__ import print_function" be used, which will make 2.7 like > 3.3. Oh, I just noticed that the person using 2to3 wasn't the OP. My apologies, my language was aimed at the decorator's primary developer. Yasar, are you prepared to take on Python 3 support fully? If it's as simple as tweaking the Print nodes, that shouldn't be too hard (I hope). ChrisA