Skip to content

Py23

Jonas Eschle requested to merge py23 into master

I have changed the code to make it python 2 and 3 compatible. Worth noting:

  • I rather implemented 3-4 small if-else then adding an additional library as a dependency (future) which would contain those things already. As we do not have a lot of those "hacks", I think this is fine.
  • strings: in python 3, every string is unicode. Therefore, the effects on the file-system handling are not quite clear (but I expect them to work as long as we do not use wrong characters).
  • performance: as some iterators do not exist any longer in python 3 but are the default (like zip vs izip), I simply replaced the iterators with the "slower" function (in python 3, everything is perfect again, even faster). If this is a performance bottleneck, we can of course either a) apply an if-else hack as well or b) use the future library, which nicely solves the problems most of the time. I have marked these appearances with "TODO py23" so @apuignav you may check them to confirm that they are not a bottleneck (of course, the iterator tools remain iterators).

Unittests are working for me in python 2 and 3 and so does my hello world script. We may need to check some more sophisticated code.

Sidenote: there are some list(range()) things, the list is unnecessary in py2 but required in py3. I minimized the conversion to list and only applied it where needed.

Edited by Jonas Eschle

Merge request reports