Python Forum
when will Python3 be THE Python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
when will Python3 be THE Python?
#11
i went ahead and changed my "py" symlink to Python version 3. i only use it to start an interactive Python.

Output:
lt2a/phil /home/phil 17> py3 Python 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> lt2a/phil /home/phil 18> py2 Python 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> lt2a/phil /home/phil 19> py Python 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> lt2a/phil /home/phil 20>
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#12
However, in my Mac, whenever I type python on the terminal , it always comes as python 2 - i have to type python 3 for the 3.7.3 version to come - that must mean that python 3 isn't the official python yet
However it won't be long before this happens python Cool
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply
#13
I will still use pyenv on newer distros for it's flexibility that is unmatched bye whatever can mix together or mess up yourself Wink
Back to old days Python 2.4.
tom@tom:~$ python -V
Python 3.8.3

# Time travel
tom@tom:~$ pyenv global 2.4
tom@tom:~$ python -V
Python 2.4
tom@tom:~$ pip --version
pip 1.1 from /home/tom/.pyenv/versions/2.4/lib/python2.4/site-packages/pip-1.1-py2.4.egg (python 2.4)

# To old going back again
tom@tom:~$ pyenv global 3.8.3
tom@tom:~$ python -V
Python 3.8.3
tom@tom:~$ pip --version
pip 19.2.3 from /home/tom/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip (python 3.8)
A other strength of pyenv if want to use/test other version say Anaconda or PyPy.
PyPy is an impressive project that has been worked on since 2007.
Some code.
def fibonacci(n):
    if n == 1 or n == 0:
        return 1
    else:
        return fibonacci(n-1) + fibonacci(n-2)

print(fibonacci(38))
So 23,3-sec with python 3.8.3.
tom@tom:~$ python -V
Python 3.8.3
tom@tom:~$ time python fib.py
63245986

real	0m23,352s
user	0m23,316s
sys	0m0,009s
Install newest PyPy with pyenv and test.
So from 23,3-sec to 1,3-sec Shocked with PyPy.
tom@tom:~$ pyenv install pypy3.6-7.3.1
Downloading pypy3.6-v7.3.1-linux64.tar.bz2...
-> https://bitbucket.org/pypy/pypy/downloads/pypy3.6-v7.3.1-linux64.tar.bz2
Installing pypy3.6-v7.3.1-linux64...
Installed pypy3.6-v7.3.1-linux64 to /home/tom/.pyenv/versions/pypy3.6-7.3.1

tom@tom:~$ pyenv global pypy3.6-7.3.1
tom@tom:~$ python -V
Python 3.6.9 (2ad108f17bdb, Apr 07 2020, 02:59:05)
[PyPy 7.3.1 with GCC 7.3.1 20180303 (Red Hat 7.3.1-5)]

tom@tom:~$ time python fib.py
63245986

real	0m1,341s
user	0m1,263s
sys	0m0,045s
Reply
#14
which python do you get if you create a fresh new user, login to that fresh new user, never run pyenv, and run python -V?

python and py get python3 only because i have set it that way in /usr/host/bin which is also added to the PATH variable ahead of even /usr/local/bin. i don't know if you can safely do that on a Mac.

you have your tabs set to 4? i hope you are not putting tabs in your .py files.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020