Python preprosessor

Tuomas Vesterinen tuomas.vesterinen at
Sun Jun 7 12:31:07 EDT 2009

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:

#ifdef python2
print u'foo', u'bar'
#ifdef python3
print('foo', 'bar')
<end code>

 > cpp -E -Dpython2
print u'foo', u'bar'

Any other suggestions?

Tuomas Vesterinen

More information about the Python-list mailing list