Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'url:pypi': 0.03; 'subject:Python': 0.06; 'must.': 0.07; 'lawrence': 0.09; 'developer': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; '<>.': 0.14; "wouldn't": 0.14; 'changes': 0.15; 'imposing': 0.16; 'pity': 0.16; 'possible?': 0.16; 'thread,': 0.16; 'wrote:': 0.18; 'module': 0.19; 'cc:addr:python.org': 0.22; 'unicode': 0.24; 'url:moin': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'wonder': 0.29; 'mix': 0.30; 'especially': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; "skip:' 10": 0.31; 'url:wiki': 0.31; 'this.': 0.32; 'url:python': 0.33; 'maybe': 0.34; "i'd": 0.34; "can't": 0.35; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'next': 0.36; "didn't": 0.36; 'url:org': 0.36; 'should': 0.36; 'so,': 0.37; 'received:209': 0.37; 'pm,': 0.38; 'url:mail': 0.40; 'read': 0.60; 'url:3': 0.61; 'skip:* 10': 0.61; "you're": 0.61; 'url:0': 0.67; 'to:addr:yahoo.co.uk': 0.84; 'carlos': 0.91; 'joel': 0.91; 'url:*': 0.95; 'subject: #': 0.96; '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 :cc:content-type; bh=MkfnnY1N8lAcQ3+U+mL0ZOLKIrq2XuS7fBPFwRBZfyo=; b=YqjFArUvfOxRTUD0ShBvPdHZHuDo71M+/O+i/WD5YyIObrHYlCuKws9+YNlA8FubjL WU2eRGqU5385xAjhEFA5gjqWzCj5Aa7feR8bwhgBeNOMkmmoSjUH9xkQ/IF579gfF9Yg Lp4IEmYKH7ua7sRcT1C1N8soAkQ7p00TE/IJgjNTRPEsjapT3k1JxMIJZc3OS6cY60uq QTIDV0HSX5JIkXqDAdkxufN5ttIGxPS5f9gYykuOioPWO0hMM+4OvALlVjcavq6Esk+1 3Rgep3uU/cmp27gA2IV/WE3zksTpM55uk0lFFQFY/9Rn3Yd2A1OcYjgXbldJJHAWH+qu lizg== MIME-Version: 1.0 X-Received: by 10.52.164.211 with SMTP id ys19mr16503441vdb.102.1369779959161; Tue, 28 May 2013 15:25:59 -0700 (PDT) In-Reply-To: References: Date: Tue, 28 May 2013 18:25:59 -0400 Subject: Re: Python #ifdef From: Joel Goldstick To: Mark Lawrence Content-Type: multipart/alternative; boundary=001a11c24e12e2f27f04ddcebf49 Cc: "python-list@python.org" 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: 103 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369779961 news.xs4all.nl 15871 [2001:888:2000:d::a6]:56824 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46345 --001a11c24e12e2f27f04ddcebf49 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, May 28, 2013 at 6:18 PM, Mark Lawrence wro= te: > On 28/05/2013 20:46, Carlos Nepomuceno wrote: > >> Are there Python 'preprocessor directives'? >> >> I'd like to have something like '#ifdef' to mix code from Python 2 and 3 >> in a single file. >> >> Is that possible? How? >> >> > https://pypi.python.org/pypi/**six/1.3.0 > > -- > If you're using GoogleCrap=E2=84=A2 please read this http://wiki.python.o= rg/moin/* > *GoogleGroupsPython . > > Mark Lawrence > > -- > http://mail.python.org/**mailman/listinfo/python-list > my original response was from cell phone. I just answered that you can't do ifdefs, implying that there is no preprocessor in python. I learned a lot of things I didn't know reading the thread, but I wonder if it is a good idea in general to try to write code like this. -- combined 2.x/3.x codebase can be a bear to maintain. I wouldn't do it unless there was some imposing reason that I must. Its not just print() -- that isn't bad, but changes in module names (urllib), arithmetic, and unicode especially make this idea in general, very tricky. Pity the next developer who needs to try to maintain it. So, maybe you CAN do it, but SHOULD you want to do it? --=20 Joel Goldstick http://joelgoldstick.com --001a11c24e12e2f27f04ddcebf49 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Tue, May 28, 2013 at 6:18 PM, Mark Lawrence &l= t;breamoreboy@= yahoo.co.uk> wrote:
On 28/05/2013 20:46, Carlo= s Nepomuceno wrote:
Are there Python 'preprocessor directives'?

I'd like to have something like '#ifdef' to mix code from Pytho= n 2 and 3 in a single file.

Is that possible? How? =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0


= https://pypi.python.org/pypi/six/1.3.0

--
If you're using GoogleCrap=E2=84=A2 please read this http://wiki.pyth= on.org/moin/GoogleGroupsPython.

Mark Lawrence

--
http://mail.python.org/mailman/listinfo/python-list

my or= iginal response was from cell phone.=C2=A0 I just answered that you can'= ;t do ifdefs, implying that there is no preprocessor in python.=C2=A0 I lea= rned a lot of things I didn't know reading the thread, but I wonder if = it is a good idea in general to try to write code like this.=C2=A0 -- combi= ned 2.x/3.x codebase can be a bear to maintain.=C2=A0 I wouldn't do it = unless there was some imposing reason that I must.=C2=A0 Its not just print= () -- that isn't bad, but changes in module names (urllib), arithmetic,= and unicode especially make this idea in general, very tricky.=C2=A0 Pity = the next developer who needs to try to maintain it.

So, maybe you CAN do it, but SHOULD yo= u want to do it?

-- <= br>
--001a11c24e12e2f27f04ddcebf49--