rcfduarte / nmsat

Simulate and analyse complex microcircuits
GNU General Public License v2.0
6 stars 1 forks source link

Porting to Python 3 #24

Closed zbarni closed 7 years ago

zbarni commented 7 years ago

So the porting raises one key issue: do we want 1 codebase for both Python 2.7 and 3.4+? Or both for now with the intention of dropping 2.7 later? Or no 3.4+ at all and just 2.7?

If yes, we'll probably need another package that bridges the 2 versions: six. It's needed because some stuff is incompatible, e.g., dict.iteritems() doesn't exist in Python3. six would allow, in some cases, to use a single function (and it would call the right one based on which Python version the user is running). In some other cases, such as xrange(), we'll need to use try: xrange.. except: range... and so on.

In some places it will definitely make the code less straightforward, but it's possible to do it.

rcfduarte commented 7 years ago

The ideal scenario would be to have a different codebase for python 3.4+. I would say we leave the current code version in Python 2.7 but start working on a branch corrected for Python 3.4+ (which could, for example be released later as a second version). I have actually just started working with it last week and it feels much better than 2.7.. It is not a priority, but when we have time, we could gradually work on a dedicated branch for Python3.