<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 28, 2013 at 6:18 PM, Mark Lawrence <span dir="ltr"><<a href="mailto:breamoreboy@yahoo.co.uk" target="_blank">breamoreboy@yahoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 28/05/2013 20:46, Carlos Nepomuceno wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Are there Python 'preprocessor directives'?<br>
<br>
I'd like to have something like '#ifdef' to mix code from Python 2 and 3 in a single file.<br>
<br>
Is that possible? How?                                  <br>
<br>
</blockquote>
<br>
</div><a href="https://pypi.python.org/pypi/six/1.3.0" target="_blank">https://pypi.python.org/pypi/<u></u>six/1.3.0</a><span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
If you're using GoogleCrap™ please read this <a href="http://wiki.python.org/moin/GoogleGroupsPython" target="_blank">http://wiki.python.org/moin/<u></u>GoogleGroupsPython</a>.<br>
<br>
Mark Lawrence<br>
<br>
-- <br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br></div><div class="gmail_extra">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.<br>
<br></div><div class="gmail_extra">So, maybe you CAN do it, but SHOULD you want to do it?<br clear="all"></div><div class="gmail_extra"><br>-- <br><div dir="ltr"><div>Joel Goldstick<br></div><a href="http://joelgoldstick.com" target="_blank">http://joelgoldstick.com</a><br>
</div>
</div></div>