We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Which Python 2 or 3

  • Which Python should I learn for the Omega 2?
    2 or 3

  • On the actual available Omega it has just Python2 available. If you want Python3 you have to build it.

    In my opinion Python2 is ok, but it really depends also on what you want to do.
    Maybe you give a bit more details about your plans/knowledge, so we can give your more specific advice's.

    Python2 in the newer versions got some changes from Version3 to. In the other hand when you just want to start with Python3 there are scripts where you can convert Pyton3 to Python2. However, code which makes heavy use of 3.x only features (such as function annotations or extended tuple unpacking) is unlikely to be converted successfully.

    Here you can read more about what you have to take in consideration:

    Welcome in the Onion Community!

  • The Python2 is not supported in 2020, for further consider might be using Python3

  • @Luciano-S. said in Which Python 2 or 3:

    On the actual available Omega it has just Python2 available. If you want Python3 you have to build it.

    You are wrong, there is 2 packages to install Python 3 on opkg :
    python3 - 3.4.3-2 - This package contains the (almost) full Python install. It's python3-light + all other packages.
    python3-light - 3.4.3-2 - This package is essentially the python3-base package plus a few of the rarely used (and big) libraries stripped out into separate packages.

    There is no such thing as learning Python 2 or 3; it is the same language. For a beginner that is not using some advanced Python constructs, you won't notice that much differences.

    I work with Python almost everyday, I have some projects done with Python 2 that I use for work that would be too long to convert to Python 3 (time is money) so I use both. I try using Python 3 for all my new projects. A couple years ago, there were some important libraries that I used that were not yet ported to Python 3. Right now, I can't find a library that I use that is not ported to Python 3.

    Seriously, the differences I see the most are the way strings are handled (all unicode in Python 3) and the ubiquitous print function. There are some nice additions to Python 3 though.

    I hope that answers some of your questions.

  • @Fred-Blais thx for your correction. If it is compiled and ready to use it sounds great?
    How would be the command to install it?:

    opkg install python-light and it will run without this famous Kernel-Version mismatch?

    I installed it right now with the Command above ... and i get:

    Python 2.7.9 (default, Jan 31 2016, 14:15:11) 
    [GCC 4.8.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.

    My statement was about that ...when you install it as mentioned in the wiki you will get just the Version2

    Could you please make some notes here or direct on github how to install version 3? If this is so easy as install Version2 everyone should know it šŸ˜‰

  • @Luciano-S.

    just type :

    opkg install python3-light
    opkg install python3

    and then you have to run the right executable (python3). You can do a symbolic link to python so you just have to type python in the command line to run the interpreter.

  • Thx, i will add this on Github (done).

    /usr/bin# ln -s python3 python would be the symlink right? As root of corse...

  • @Luciano-S said in Which Python 2 or 3:

    In my opinion Python2 is ok, but it really depends also on what you want to do.

    Python has a rule that all 2.x versions will be backward compatible . The same rule applies to Python 3.x versions. However, Python does not guarantee backward compatibility between versions. Python 3 introduced several changes to the actual structure and syntax of the Python language. The whole Python community was pretty much sceptical when they received Python 3.x. Python 3.0 is fundamentally different to previous Python releases because it is the first Python release that is not compatible with older versions . Most of the things written in Python 2.x were not compatible with Python 3.x, as it did not support backward compatibility. Many applications and frameworks needed to rewritten completely due to this, hence, it was very difficult to port to Python 3.x from Python 2.x . Programmers who first learned to program in Python 2.x sometimes find the new changes difficult to adjust to, but newcomers often find that the new version of the language makes more sense.

  • Not sure why you bump a 4 year old topic.
    Python 2 officially hit the End of Life (EOL) deadline on Jan 1 2020. As of this date, no new bug reports, fixes or changes will be made to Python 2 making the whole above discussion an obsolete topic; there is no other choice left than Python 3.

Log in to reply

Looks like your connection to Community was lost, please wait while we try to reconnect.