T
Tuomas Vesterinen
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>
results:
print u'foo', u'bar'
Any other suggestions?
Tuomas Vesterinen
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>
results:
....> cpp -E -Dpython2 test_cpp.py
print u'foo', u'bar'
Any other suggestions?
Tuomas Vesterinen