Closed Septaris closed 7 years ago
I would love to support both at some point. If you want to spend the time, that would be awesome!
I have been avoiding 'iteritems()' since I noticed that it was changed in python 3. But I think it was how 'struct' works python3 that made me pause. I am not sure if it requires big or small modifications but I wanted to improve the ByteStream module anyway, make it more flexible. I think ByteStream deserves its own repository... done. Might be best I do the changes I have in mind first before anything else is done in that module.
Be careful, in the SmdSegment module some loops over 'items()' would make a list of all blocks. Iterating over keys() is how I try to avoid it since then. I am not sure that is the best solution? Thanks!
I'm working on the python 3 support (fork branch p2p3). There are still some bugs but I hope to have time tomorrow to fix them.
Great! I have no plans for big changes at the moment and since my vacation is coming to an end I will not have the time to cause major branch conflicts, in case you worried.
I did take a look. Some things I noticed. If I used 'long' somewhere, it would be best to simply replace it with 'int' and hope it works. Will have a closer look at some timestamps if it is required there. 'basestring' can be replaced with 'str', 2,7 will loose unicode support but I doubt anyone will notice.
For long int support, we just need to use:
from builtins import int # subclass of long on Py2
see long and int with future for details
For basestring, I have to make a few changes but everything is detailed here
Everything will be alright ;)
Some of it seems to require 'pip install future' and I would rather avoid such a requirement. Someone should only need to install basic python2.7 or 3.4 and it should work. A 'pip' requirement is a hurdle that could prevent someone from giving the tool a try, thats is my worry.
News from p2p3 branch: the code seems to work in both python 2 and python 3 (for the moment the future module is required). I need to go further with testing before making a release but it looks promising.
Good work!
The latest version should work with both python 2.7 and 3, thanks a lot!. I removed the 'future' references to avoid pip, for now. A next big step will be the 'MetaBlock', I will have to test how much of an impact the 'metaclass' will make.
Hi Peter, do you plan to support Python 3 ? If so, i can help you to convert the code (as soon as you switch from tab to space indentation). I just need to know if you want to support both Python 2 and 3 or just Python 3 for future version.