GSoC'17 Proposal :- Adding Python 3 support
#3
(2017-03-14, 18:07)rohit-rk Wrote: With Python 3 being the future of Python while Python 2 in active use, I think having support for both would be a good idea.

Even the python communites support for both. There is this six compatibility package, a key utility for supporting Python 2 and Python 3 in a single code for small projects.
For dicussion about Python3 maybe start by also reading discussions in these two threads:

http://forum.kodi.tv/showthread.php?tid=205204

http://forum.kodi.tv/showthread.php?tid=216598

Sounds as if the "six compatibility package" is no longer the best option for supporting both Python 2 and Python 3 in Kodi.

http://forum.kodi.tv/showthread.php?tid=...pid2478984
(2016-12-15, 01:56)Hedda Wrote: Don't know about Kodi's core interface to Python, but as plain Python scripting language goes it should today be much smoother to upgrade to Python 3 and stay backwards compatible with Python 2 as there is now a new compatibility package that should make running Python 2 scripts under Python 3 easier.

Checkout: http://python-future.org/overview.html
Quote:python-future is the missing compatibility layer between Python 2 and Python 3. It allows you to use a single, clean Python 3.x-compatible codebase to support both Python 2 and Python 3 with minimal overhead.

It provides future and past packages with backports and forward ports of features from Python 3 and 2. It also comes with futurize and pasteurize, customized 2to3-based scripts that helps you to convert either Py2 or Py3 code easily to support both Python 2 and 3 in a single clean Py3-style codebase, module by module.

Notable projects that use python-future for Python 2/3 compatibility are Mezzanine and ObsPy.
As before it was adviced that if you upgraded to Python 3.x interpreter then you could still keep some backwards compatibility with Python 2.7 if you use the "six compatibility package" (for reference see http://packages.python.org/six/ ).

Now however the Python interpreter developers have made a new compatibility package that is called "python-future" (and it is also refered to as "future compatibility package"), so please see:

http://python-future.org/index.html ( and the actual package on GitHub https://github.com/PythonCharmers/python-future )

This "future compatibility package" is still in beta and doesn't support as many versions of Python as the six (it only goes back as far as Python 2.6, while six supports Python 2.4), but allows Python 2 compatible code to be written in a style that is closer to idiomatic Python 3 (for example, it includes an actual Python 2 compatible implementation of the Python 3 bytes type, rather than relying on the Python 2.x 8-bit string type that exposes a slightly different API).

Recommmed that you read both https://wiki.python.org/moin/Python2orPython3 and http://python-future.org/index.html

It suggest that much modern Python code should run largely unmodified on Python 3 using this "future compatibility package".
Reply


Messages In This Thread
RE: GSoC'17 : Adding Python3 support project Query. - by RockerC - 2017-03-15, 10:33
Logout Mark Read Team Forum Stats Members Help
GSoC'17 Proposal :- Adding Python 3 support2