Hacker News new | past | comments | ask | show | jobs | submit login

Python 2 and 3 are different compiler/interpreters. Python 2 code might run on a Python 3 interpreter, but probably not. When you run your python2 code, you can specify that it is to run on the Python 2 compiler/interpreter. The Python 2 compiler/interpreter will continue to run and thus be able to run python2 code for a very long time.

Ubuntu 18.04 example:

    $ python --version
    Python 2.7.15+

    $ python2 --version
    Python 2.7.15+

    $ python3 --version
    Python 3.6.8

    $ ls -l /usr/bin/python
    lrwxrwxrwx 1 root root 9 Apr 16  2018 /usr/bin/python -> python2.7



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: