Closed
Description
The current state of python code:
- Tree Traversal (python2 and unfinished python3)
- Euclidean Algorithm (python2)
- Bubble Sort (python3, but unlisted)
- FFT (python2)
My question is if we really need to split the code into separate implementations for python2 and python3. It would probably be a much better design to just have a python
implementation, and write it so it runs on both versions. For practical purposes this means that it is the print
-statement that is going to be the most obvious problem to combine, but this very neatly fixed by including the following code at the start
from __future__ import print_function
which allows python2 to write print('Hello World')
. The second most obvious difference is that the division operator /
is interpreted as integer-division in python2 while always floating point division in python3. Again: we can write compatible code by including the __future__
library
from __future__ import division