Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.fsmpi.rwth-aachen.de!news.unit0.net!news2.euro.net!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; 'python.': 0.02; 'yet.': 0.04; 'subject:Python': 0.06; 'must.': 0.07; 'developer': 0.10; 'python': 0.11; "wouldn't": 0.14; 'changes': 0.15; '#ifdef': 0.16; 'imposing': 0.16; 'pity': 0.16; 'received:65.55.116.7': 0.16; 'thread,': 0.16; 'module': 0.19; 'to:name:python-list@python.org': 0.22; 'received:65.55.116': 0.24; 'unicode': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'wonder': 0.29; "doesn't": 0.30; 'especially': 0.30; 'code': 0.31; 'piece': 0.31; 'this.': 0.32; 'run': 0.32; 'call.': 0.33; 'date:': 0.34; 'maybe': 0.34; "can't": 0.35; 'but': 0.35; 'there': 0.35; 'next': 0.36; "didn't": 0.36; 'thanks': 0.36; 'should': 0.36; 'so,': 0.37; 'email addr:python.org': 0.37; 'to:addr:python-list': 0.38; 'short': 0.38; 'skip:_ 30': 0.39; 'does': 0.39; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'email addr:gmail.com': 0.63; 're:': 0.63; 'email name:python-list': 0.65; 'catch?': 0.84; 'joel': 0.91; 'subject: #': 0.96; '2013': 0.98 X-TMN: [JCU1fi/qgn7ZigcqVwFGaQtTe2K6JZMw] X-Originating-Email: [carlosnepomuceno@outlook.com] From: Carlos Nepomuceno To: "python-list@python.org" Subject: RE: Python #ifdef Date: Wed, 29 May 2013 01:50:35 +0300 Importance: Normal In-Reply-To: References: , , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 28 May 2013 22:50:35.0640 (UTC) FILETIME=[C4281780:01CE5BF5] 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369781444 news.xs4all.nl 15888 [2001:888:2000:d::a6]:33645 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46346 ________________________________=0A= > Date: Tue=2C 28 May 2013 18:25:59 -0400 =0A= > Subject: Re: Python #ifdef =0A= > From: joel.goldstick@gmail.com =0A= > To: breamoreboy@yahoo.co.uk =0A= > CC: python-list@python.org =0A= [...]=0A= > =0A= > my original response was from cell phone. I just answered that you =0A= > can't do ifdefs=2C implying that there is no preprocessor in python. I = =0A= > learned a lot of things I didn't know reading the thread=2C but I wonder = =0A= > if it is a good idea in general to try to write code like this. -- =0A= > combined 2.x/3.x codebase can be a bear to maintain. I wouldn't do it = =0A= > unless there was some imposing reason that I must. Its not just =0A= > print() -- that isn't bad=2C but changes in module names (urllib)=2C =0A= > arithmetic=2C and unicode especially make this idea in general=2C very = =0A= > tricky. Pity the next developer who needs to try to maintain it. =0A= > =0A= > So=2C maybe you CAN do it=2C but SHOULD you want to do it? =0A= > =0A= > -- =0A= > Joel Goldstick =0A= > http://joelgoldstick.com =0A= =0A= =0A= Thanks Joel! In this case I think it does because I would like to have the = same short benchmarking script to be runnable by Python 2 and Python 3.=0A= =0A= The only piece of code that doesn't run on Python 2 is a to_bytes() single = call. So it's not a huge maintenance load. =3B)=0A= =0A= I didn't try to write 'portable' code to Python 3 yet. What's the catch? = =