Python preprosessor

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Jun 9 02:58:10 EDT 2009


En Sun, 07 Jun 2009 13:31:07 -0300, Tuomas Vesterinen  
<tuomas.vesterinen at iki.fi> escribió:

> I am developing a Python application as a Python2.x and Python3.0  
> version. A common code base would make the work easier. So I thought to  
> try a preprosessor. GNU cpp handles this kind of code correct:
>
> <test_cpp.py>
> #ifdef python2
> print u'foo', u'bar'
> #endif
> #ifdef python3
> print('foo', 'bar')
> #endif
> <end code>

See ifdef.py in the Tools/scripts directory for a pure Python preprocessor.

-- 
Gabriel Genellina




More information about the Python-list mailing list