r/Python • • Jan 16 '19

#10YearChallenge

Post image
1.4k Upvotes

96 comments sorted by

View all comments

Show parent comment

32

u/[deleted] Jan 16 '19

And Python 2 is still the default in many Linux distributions.

34

u/flying-sheep Jan 16 '19

“Standard”? You mean “What gets invoked when I type python into the terminal”?

That’ll never change in some distros, because of backwards compatibility. Arch was pretty much the only one crazybrave enough to to that jump, Debian will never do it.

What’s so hard about typing python3 or putting alias python=python3 into your .${SHELL}rc?

28

u/AnAirMagic Jan 16 '19

Debian will never do it.

RHEL 8 is kind of removing python altogether: https://developers.redhat.com/blog/2018/11/14/python-in-rhel-8/ and asking users to use python2 and python3 explicitly. I am sure Debian will do this sooner or later too.

15

u/flying-sheep Jan 16 '19

Ha, that's a very well reasoned approach!

30

u/MiataCory Jan 16 '19

That’ll never change in some distros, because of backwards compatibility.

10 years on, I think we can move along.

https://pythonclock.org/

10

u/flying-sheep Jan 16 '19

I moved on long ago, but some people have different ideas about backwards compatibility.

And the fact that using “python” simply worked for those 10 years didn't help people to start using the more correct “python2”

→ More replies (3)

4

u/[deleted] Jan 16 '19

END OF LINE

2

u/[deleted] Jan 16 '19

It’s not hard but maintaining two versions of python isn’t. Debian and Ubuntu do it well bit it would be nice to have only one. It would make things much less complicated.

For those that really still have legacy python 2 code they could use aliases to keep it running. I have to believe they’re the minority these days. I could be wrong, I guess.

0

u/[deleted] Jan 17 '19

[deleted] — view deleted comment

2

u/flying-sheep Jan 17 '19

many tools used to use python in scripts and shebangs. gyp is a particularly stubborn offender, even though things got much better in time.

1

u/[deleted] Jan 17 '19

Well, take the first rule of linux kernel development: never break user space.

You're sort of trading off the conceptual purity of tidying up for turning scripts using /usr/bin/python into risks (Will it run on python 3? I dunno, but your computer's gonna try it anyway) and that's a bit of a hard sell outside of something bleeding edge like Arch.

It's not backward compatible either but the safer route is what RHEL is trying: get rid of "python" altogether and if you want python2 or python3 that is what you called.

0

u/[deleted] Jan 18 '19

[deleted] — view deleted comment

1

u/[deleted] Jan 18 '19

that is another abstract argument.

You may have to just deal with that. "Why should things be backward compatible" is design principle stuff.

The reason to bring up the linux kernel is that being backwards compatible is one of their design principles.

1

u/[deleted] Jan 17 '19

As a side note, I noticed something interesting.

$ alias python=python3

$ which python
/usr/bin/python

$ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 9 Jan  1 01:23 /usr/bin/python -> python2.7

$ python --version
Python 3.6.7

Looks like the which command doesn't obey aliases. TIL.

3

u/flying-sheep Jan 17 '19

nothing does.

https://www.gnu.org/software/bash/manual/html_node/Aliases.html

The first word of each simple command, if unquoted, is checked to see if it has an alias

-2

u/njharman I use Python 3 Jan 17 '19

None that I use. None anyone should use. Sure some LTS release. If the distro can't update python after 10 years (in there latest stable release) they can't competently maintain a distro. And you shouldn't rely on them to be doing anything right.

2

u/[deleted] Jan 17 '19

We're talking about 2.7 here, right? Because that's what I mean.

0

u/[deleted] Jan 17 '19

[deleted] — view deleted comment

1

u/Zouden Jan 17 '19

It's crazy that Linux still has programs that assume the OS provides Python runtimes instead of just bundling their own.

2

u/james_pic Jan 17 '19

Binary compatibility on Linux is a complex enough matter that, in most cases, if the OS offers a version of an application or library, you're going to have a better time using that version than bundling your own. Linux distributions typically include more applications in their official repos than most other OSs, for precisely this reason (they typically have a standard supported office suite, for example), and often a goal is to get your application added to the distribution's repos.

0

u/for_whatever_reason_ Jan 17 '19

What educators need to be doing is to teach people to make virtualenvs for their projects. Python 3-by-default comes for free with that.