Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46346 > unrolled thread

RE: Python #ifdef

Started byCarlos Nepomuceno <carlosnepomuceno@outlook.com>
First post2013-05-29 01:50 +0300
Last post2013-05-29 01:50 +0300
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  RE: Python #ifdef Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-29 01:50 +0300

#46346 — RE: Python #ifdef

FromCarlos Nepomuceno <carlosnepomuceno@outlook.com>
Date2013-05-29 01:50 +0300
SubjectRE: Python #ifdef
Message-ID<mailman.2331.1369781444.3114.python-list@python.org>
________________________________
> Date: Tue, 28 May 2013 18:25:59 -0400 
> Subject: Re: Python #ifdef 
> From: joel.goldstick@gmail.com 
> To: breamoreboy@yahoo.co.uk 
> CC: python-list@python.org 
[...]
>  
> 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? 
>  
> --  
> Joel Goldstick 
> http://joelgoldstick.com 


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.

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. ;)

I didn't try to write 'portable' code to Python 3 yet. What's the catch? 		 	   		  

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web