News for hackers. Stuff that matters.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by VeejayRampay on Wednesday April 11, 2018 @03:56AM (#16808946)
The double standard when it comes to Python is mindblowing. No other language could have gotten away with such ridiculous fragmentation and perf regression for such a long period of time.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by ceronman on Wednesday April 11, 2018 @04:24AM (#16809089)
What do you mean by double standard? Everyone in the community, including the core developers, acknowledge that the 2 to 3 story was full of mistakes. They have promised not to make it again. And they took some actions to remedy the problems, and that's why Python 3 is finally succeeding.

I recommend this presentation by Victor Stinner at FOSDEM 2018 which talks about it: https://fosdem.org/2018/schedule/event/python3/

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by hyperpallium on Wednesday April 11, 2018 @10:22AM (#16811337)
Could someone provide a summary of the kinds of mistakes/remedies?
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by takeda on Wednesday April 11, 2018 @12:04PM (#16812506)
Did not watch the presentation but IMO the primary mistake was not declaring EOL for 2.x sooner. Other languages had similarly breaking changes and they simply gave short time before legacy version was declared EOL and developers ported their applications to the new version.

In Python it took 10 years, and even now you can't get companies to migrate, because why make developers do the work when application still can be used. Many places will probably start the migration in 2020, which shows that giving 10 years head start was a mistake and all it did was create FUD and division in the community.

The Python 3 immediately picked up for new projects after announcement that 2.7 will no longer have new feature and only bugfixes in 2015. Industry will wait for the last moment when all support for 2.7 will be ceased in 2020.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by collinmanderson on Wednesday April 11, 2018 @12:16PM (#16812627)
For the record, Python 2.7 EOL was originally 2015. In 2014, it was moved later, likely because RedHat would continue to maintain it for free anyway.

https://legacy.python.org/dev/peps/pep-0373/#id2

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by ceronman on Thursday April 12, 2018 @03:10AM (#16818654)
One mistake was providing 2to3 as a migration path. This required projects to move completely from 2 to 3, for libraries it meant that they had to either stop supporting 2 (which were the majority of their users) or forking and maintaining both versions. The remedy was to make it possible for libraries to be both 2.7 and 3.x compatible, using tools such as six.py and making some changes to 3.x to make it more compatible with 2 (e.g. adding u'' strings).
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by Too on Saturday April 14, 2018 @03:09AM (#16836278)
The problem with six is that once you decide to use it your entire code base must be written with the lowest common denominator in mind, in this case py2.7. You can't use six.py at the interface boundaries and nice python3 features inside your implementation. Six is only useful for old 2.7 libraries that want to quickly be 3.x compatible and still maintain their 2.7 compatibility, not if you have an old 2.7 application and want to incrementally add 3.x features.

The proper way make a major breaking change like python did is to provide a bridge between the two versions, so you could import 2.7 modules from 3.x applications, and even the other way around. As of today there is still no such thing.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by VeejayRampay on Wednesday April 11, 2018 @06:54AM (#16809783)
The double standard is that people still stick to Python despite those problems. If we're being honest and all conspiracy aside, imagine the same story for Ruby (a very similar language in terms of capability, features and performance), everyone would be laughing at them and the language would be pulling a Perl right now.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by username223 on Wednesday April 11, 2018 @11:55AM (#16812390)
Those three scripting languages actually an interesting comparison.

Perl 5 -> 6 broke all your code in exchange for a whole new language. Some people moved to Perl 6, some to other languages, and a lot stayed with Perl (5), which still runs programs written in Perl 1.

Ruby 1.8 -> 1.9 broke most of your code in exchange for minor cleanups. But Ruby was Rails, so the culture accepted constant rewriting and breakage, and people went along.

Python 2 -> 3 also broke most of your code in exchange for minor cleanups. Users expected some stability, but the language's culture demanded conformity. The result has been a decade-long war in which Python fans try to shame Python users into moving to version 3.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by irishsultan on Wednesday April 11, 2018 @01:02PM (#16813166)
> But Ruby was Rails, so the culture accepted constant rewriting and breakage, and people went along.

The main reason people switched probably wasn't rails making people expect breakage, the main reason was that (a) it was relatively easy to rewrite your code to work on both 1.8 and 1.9 (as long as your dependencies had already done it), and (b) 1.9 was much faster.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by kec on Wednesday April 11, 2018 @12:46PM (#16812954)
> The result has been a decade-long war in which Python fans try to shame Python users into moving to version 3.

I think that's the most succinct way to put this whole debacle I've ever seen. I'm totally stealing this.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by simonh on Wednesday April 11, 2018 @08:10AM (#16810284)
I do not think double standard means what you think it means.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by jamesgeck0 on Wednesday April 11, 2018 @08:26AM (#16810374)
Ruby had 1.9. It was like the Python 3 situation in miniature, and Matz has said he’s keen to avoid such a mistake again.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by takeda on Wednesday April 11, 2018 @12:13PM (#16812601)
It also was in a minor version change 1.8 -> 1.9, but people moved on because 1.8 was declared EOL this is what Python was missing. Python 3 is 10 years old and 2.7 is still supported (bufixes, but still).

If you look at timing, Python 3 picked up for new projects in 2015, when PSF declared that no new features will be backported to Python 2 from 3.

I believe the industry will wait for 2020 to start migrating existing code after Python 2.7 will be declared EOL.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by toyg on Wednesday April 11, 2018 @07:46AM (#16810136)
That massive chip on your shoulder is weighing you down.

If you really think something like that is happening (big if - I’ve gone through so many py3 flames...), the only answer is: because people love the language SO DAMN MUCH that they will overlook its warts. And the next logical step would be to find out how an independent research project, staffed mostly by volunteers and without a marketing budget of any sort (and not running in every browser nor shipping preinstalled on the most popular operating system), ended up with this sort of mindshare.

There might be some good lessons there.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by stealthcat on Wednesday April 11, 2018 @07:35AM (#16810071)
Ruby took off because of Rails. Rails' convention over configuration defies Ruby's flexible nature. It feels more like Python.

People prefer dumb unambiguous code over clever code. That's why Python and Rails succeeded

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by ComputerGuru on Wednesday April 11, 2018 @09:25AM (#16810829)
“Dumb, unambiguous code” does not rely on magic conventions that change with the whim of the framework developer.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by hyperpallium on Wednesday April 11, 2018 @04:27AM (#16809100)
I think it's the opposite. When other languages make incompatible changes, they have serious problems (e.g perl6).

Previous versions of python were back-compatible. Java versions stress back-compatibility. I don't know if HN can find any counter-examples, of a language that thrived through an incompatible, code-breaking upgrade.

Python has done everything possible to avoid this fate, by maintaining 2.7. And I'm not even convinced python has gotten away with yet (e.g. kalite, offline khan academy, needs 2.7). RHEL may end up reversing this. Give it another ten years!

Amd the Enterprize is the most back-compatible thing you've ever seen. This change is going to break lots of code, and they will reverse or lose customers.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by mratzloff on Wednesday April 11, 2018 @06:37AM (#16809699)
I don't know if HN can find any counter-examples, of a language that thrived through an incompatible, code-breaking upgrade.

Of course. Swift 3 is one example. Ruby 1.9, as others have pointed out, is another.

PHP is yet another, and perhaps more relevant because it is close to contemperaneous. It had its "Python 3 moment" with the migration to PHP 5. Lots of BC breakages.[0] That transition took about 3-4 years for most.[1] Most users are now on the current major version, 7, and the remainder on 5 are mostly using its latest release (EOL is EOY). No one uses 4.

[0] https://secure.php.net/manual/en/migration5.php

[1] https://web.archive.org/web/20110720002753/http://www.gophp5...

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by sametmax on Wednesday April 11, 2018 @06:55AM (#16809792)
Swift 3 is compiled. So you can provide the binaries and be ok.

Ruby 1.9 is a great example of why you should not be too nice: they told everybody "you have a fews months, deal with it". The community moved. Python said "poor things, we understand, take those tools and years to do the thing", and the community cried, and did nothing.

PHP literally failed. They canceled V6 and jumped to V7.

The funniest part ?

None of those languages are even close to Python popularity.

Swift is not even used for most Apple codebase. Python supported even Atari.

Ruby and PHP has almost no use case outside of the web. Python is used by OS, on the web, in GIS, by data analysts, for CGI, in AI, for sysadmin, to make GUI, video games...

And Python is much, MUCH older. 1990. 4/5 years older than Ruby/PHP. It has way more technical debt to pay. Swift ? 2014

Yeah the migration was badly handled from some aspects. But honestly, given the challenge and track record of the competition, it's not too shabby.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by hartator on Wednesday April 11, 2018 @10:26AM (#16811364)
Comparing Python and Ruby upgrades is not fair.

Ruby 1.9 was working mostly the same as 1.8 while provising 2-3x speed improvment, and new exciting features.

Python 3 breaks even the basic Python 2 hello world, everything was notably slower, and not anything new and exiciting feature-wise apart ubified string support.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by mratzloff on Thursday April 12, 2018 @04:26PM (#16824636)
Yes, Python really botched it.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by mratzloff on Thursday April 12, 2018 @04:30PM (#16824670)
PHP 4 to 5, which was what my comment was about, took a middle path and had success much faster than Python did.

Given how much you like Python, I'm surprised at the gall to argue that Python had more technical debt to clean up than PHP did.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by lolc on Wednesday April 11, 2018 @09:25AM (#16810826)
The remark about PHP was the move from version four to five. It was a big move.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by protomyth on Wednesday April 11, 2018 @08:10AM (#16810279)
Swift is Apple’s baby and has a captive audience. Since Apple cannot even update their example code, I don’t think it proves any points about keeping up with a moving target.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by hyperpallium on Wednesday April 11, 2018 @10:34AM (#16811453)
Maybe I'm wrong, but I have the impression that Ruby is now an expert's language, and much less accessible to beginners than it used to be. And, while it remains useful and used, it's not growing...

When trying to learn it, I encountered incompatible examples and tutorials, complex and changing ways to update it... and then my toy code stopped working. I eventually found the cause of the code-breaking change, fixed it... thought a bit, and decided against ruby. That's just me though.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by irishsultan on Wednesday April 11, 2018 @05:03AM (#16809276)
> I don't know if HN can find any counter-examples, of a language that thrived through an incompatible, code-breaking upgrade.

Ruby qualifies, I'd say. From 1.8 -> 1.9 there were syntax changes, changes to how strings worked and so on. Code written for 1.8 would not in general work on 1.9 and the other way around. While it was possible (sometimes with some extra if statements) to write code that worked on both versions I would definitely call it an incompatible, code-breaking upgrade.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by Freaky on Wednesday April 11, 2018 @11:41AM (#16812256)
It's notable that 1.9 came with a significant performance boost, so there was a good practical reason to want to upgrade. People were motivated by the prospect of their code running twice as fast - sure, the language was improved a bit too, but it's Ruby, it's already pretty nice, so that was hardly going to light a fire under anyone.

When Python 3 turned up and it was on average slower, my first thought was "well, good luck getting people to adopt that".

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by saurik on Wednesday April 11, 2018 @05:37AM (#16809443)
The fact that it was possible to write code that worked with both wasn't just so critical, though. It allowed you to upgrade your code incrementally to support 1.9 while doing regression testing on 1.8, and then come up with a deprecation schedule for 1.8.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by rplnt on Wednesday April 11, 2018 @05:45AM (#16809482)
Python could be written that way (2/3-compatible) as well and plenty of programs and modules were.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by saurik on Wednesday April 11, 2018 @05:55AM (#16809534)
Uhhhh... sort of? I mean, I could go through all of the needless "why the hell did they make this partner incompatible also" stuff like, like removing u'' support (thai was added later), or all of the ludicrous breakage in the underlying APIs (like filesystem calls that made assumptions about character encoding that make no sense for the underlying Unix model and literally caused files to just disappear from iteration)... a lot of this stuff was fixed in later versions of Python 3, but that was years later, making it nearly impossible to deal with the existing land mines of people who had installed Python 3.0-3 (or even 3.4).

But what makes me shocked that you think that that is the case is basic basic stuff... I mean, as one obvious example, they changed the exception syntax. So, "uhhhh.... sure?" it was possible to make a program that ran on both 2 and 3, but it required using "try" with no variable assignment and then digging into Python's exception reflection support to recover the variable. And you had to do this every single time. (And of course a lot of the time the underlying core library would now throw different exceptions, making the situation all the more ludicrous.)

I had code that straddles the 1.8/1.9 boundary of Ruby, and even though I wasn't an expert at Ruby it was trivial to have code that worked for both (and I mean 100% correct: Unicode and everything; remember that neither Ruby 1.9 nor Python 3 added Unicode support, they only made Unicode support easier to obtain. for Python 2 there was already comprehensive, if non-default, support, and for Ruby 1.8 you just needed to be careful about where you did conversions).

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by sametmax on Wednesday April 11, 2018 @07:15AM (#16809921)
Half of the problem you mention are either:

- if you tried to support Python < 2.7.

- if you tried to support Python < 3.3

But nobody used 3.0, 1 or 2. And supporting 2.6 is like supporting ruby 1.7 and 1.8 and 1.9. Which nobody did.

And it's easy to rewrite libs when really the language started to be used in 2004.

Or maybe not, given that "gem install" still regularly crashes on anything other than the top 20 packages, so it's still not a solved issue.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by opencl on Wednesday April 11, 2018 @07:50AM (#16810169)
Python 3.0 came out in 2008 and 3.3 came out in 2012. Are you really saying that nobody used Python3 for the first 4 years of its existence? I was certainly using 3.1 and 3.2 back then.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by sametmax on Wednesday April 11, 2018 @07:57AM (#16810213)
Pretty much yes. Some Linux distrib where still using 2.6, and not a lot of them had even 3.2 in their packages.

Only a few like you and me tried it.

I can't recall of any big project or lib ever supporting < 3.3.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by UncleEntity on Wednesday April 11, 2018 @11:20AM (#16812006)
Blender was using py3k for quite a while before 3.3. I was doing blender dev work back then and can recall the almost immediate upgrades as soon as the newest python release came out -- kind of painful really since I prefered to use the fedora installed version instead of building from scratch so would often stall my dev work until fedora caught up to blender.

They jumped on so early the python devs were saying "WTF are you people thinking?!?"

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by sametmax on Wednesday April 11, 2018 @11:58AM (#16812419)
Given blender is mostly c bindings and a huge code base, it's kinda impressive, and a good example that it's not an impossible task to migrate even a very hard project, let alone the most common ones.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by UncleEntity on Wednesday April 11, 2018 @12:20PM (#16812665)
It wasn't a migration as much as a bottom-up rewrite of the entire bpy and big chunks of blender itself. Most of the bindings are generated by makesrna at compile (compile compile?) time which is fairly simple once you go deep diving into the sources.

It actually takes a fair bit of shenanigans to get hand-coded bindings into blender, my last(?) patch was bindings for the kdtree and I had to do some convincing to get that accepted. I'd guess that 99% of bpy is generated bindings.

If they stuck with python 2 when they started the initial overhaul they'd probably still be using it since artists are very vocal when their scripts break.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by dagw on Wednesday April 11, 2018 @08:18AM (#16810327)
Django never had support for python < 3.3 and numpy and scipy only supported python 3.2 and up. The story is similar for most other packages. So if you where using python with any of its major libraries then python 3 was pretty much useless for you the first 3-4 years.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by collinmanderson on Wednesday April 11, 2018 @12:19PM (#16812655)
Django had support for 3.2 and 3.3, but not 3.0 and 3.1. Django didn't add support for 3.x until it was able to drop 2.5 (Feb 2013).

https://docs.djangoproject.com/en/2.0/faq/install/#what-pyth...

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by icebraining on Wednesday April 11, 2018 @07:05AM (#16809850)
it was possible to make a program that ran on both 2 and 3, but it required using "try" with no variable assignment and then digging into Python's exception reflection support to recover the variable.

What? The PEP that added the new syntax also added it to Python 2.6: https://www.python.org/dev/peps/pep-3110/#compatibility

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by Xylakant on Wednesday April 11, 2018 @04:58AM (#16809248)
> When other languages make incompatible changes, they have serious problems (e.g perl6).

Counter-example: The ruby 1.8 -> 1.9 -> 2.0 upgrade path. 1.9 introduced the whole encoding system, which was a major update at the time. It did break a lot of libraries that handled strings. Still, the change went over fairly quickly, partly because major players in the ruby world (rails) adopted the change. The update also brought clear benefits and it was clearly marked that 1.8 was going to go out of support. There are still some stragglers (centos 6, I'm looking in your direction), but it's clearly accepted that ruby 2.x is the standard that you should be writing code for.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by dep_b on Wednesday April 11, 2018 @06:16AM (#16809616)
> I don't know if HN can find any counter-examples, of a language that thrived through an incompatible, code-breaking upgrade.

Swift breaks every major version at least but not as often and on a large scale anymore with point releases as with 1.x and 2.x. Has been like that from the beginning and everybody that writes it accepted it.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by Steeeve on Wednesday April 11, 2018 @05:03AM (#16809274)
> Java versions stress back-compatibility.

You reminded me of the java version incompatibility nightmares that once littered the enterprise landscape. If they do that now, it's because their history includes perhaps the worst set of incompatibility jumps of any popular language.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by canofmoi on Wednesday April 11, 2018 @05:10AM (#16809305)
Quite the opposite.

Python had deep problems that could simply not be fixed without BC breaks. The decision was made, and in hindsight it was the correct decision by Guido and other core devs.

Look at PHP, and look what a total cluster of madness the language has become.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by oblio on Wednesday April 11, 2018 @05:16AM (#16809329)
I think Python 3 was not brave enough, to be honest, to future proof Python:

* an optional type system without hacks was not introduced (types in comments, really?)

* the GIL was not removed or at least a solid parallelism story was not included, one that would allow Python to use all cores on a system while sharing, if needed, memory

* no true performance improving changes were made; by this I mean stuff that improve performance by an order of magnitude; Python is still way too dynamic and this basically sunk Google's Unladen Swallow and Dropbox's Pyston, at least in terms of worldwide adoption

I say this because I'm a bit worried that long term Python has locked itself into a corner where it will keep getting pushed into as the other languages develop a better developer UX. Python was a bit lucky to catch the ML train but who knows how long this will last. And Go, Kotlin, Typescript, Swift, Julia, Rust even are improving their ergonomics and edging towards Python's core competency.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by afarrell on Wednesday April 11, 2018 @05:45AM (#16809483)
> a bit lucky to catch the ML train

I'd argue that the fact that it was explicitly a design goal to be a teaching language meant that it saw wide-scale adoption by universities, which made it more likely that someone writing an adaptor library to old linear algebra packages would write it in python.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by petre on Wednesday April 11, 2018 @05:58AM (#16809547)
Perl6 was brave enough. It became a totally different language and lost much of its user base who moved on to Python, Ruby and to a lesser extent Node.

From what I saw, Python3 doesn't have type hints but it at least warns when you try to do stuff which involves magic, such as trying to increment a float.

Perl6 doesn't warn in those cases. If you use type inferrence it just happily goes ahead and uses the equivalent of perl5 BigNum which makes the code run 50x slower, instead of upgrading to BigNum when int overflows like Ruby does. If you use ugly C-style loops instead of nicer native for loops, your loop will run 2x faster. Too much magic or the wrong sort of magic can be really annoying sometimes.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by lizmat on Wednesday April 11, 2018 @06:25AM (#16809662)
> If you use ugly C-style loops instead of nicer native for loops, your loop will run 2x faster.

This is what I currently consider a workaround. At the moment if you have a constant endpoint and it fits in a native int, such as `for ^10`, it is already highly optimized and actually runs faster than the equivalent in Perl 5. That is not done yet where the endpoint is a native int variable. :-(

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by jononor on Wednesday April 11, 2018 @05:39AM (#16809449)
Since Python 3.5 (3 years ago) type hints are part of the core syntax. Don't need to put them in comments. https://www.python.org/dev/peps/pep-0484/#type-definition-sy...
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by oblio on Wednesday April 11, 2018 @06:00AM (#16809556)
They badly need to update the docs, then. Almost everything I see on that page does this:

vec = [] # type: Vector[float]

vec = [] # type: Iterable[Tuple[float, float]]

a = MyClass() # type: MyClass[int]

x = Foo() # type: Foo[int]

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by icegreentea2 on Wednesday April 11, 2018 @07:05AM (#16809845)
Ugh that's because PEP 484 (which introduced 'proper' type hints) only introduced it for parameters and return types and implemented in Python 3.5. Type hinting bare variables was introduced with PEP 526 and implemented in Python 3.6.

While I really like the concept of PEPs, and I think keeping original (like as they were written) PEPs around are the right thing to do, I do wish sometimes that Python did a better job at incorporating changes from PEPs into the core documentation once implemented.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by tobltobs on Wednesday April 11, 2018 @05:46AM (#16809490)
> a_list = [] # type: List[T]

How do you do that with out a comment?

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by Chickenosaurus on Wednesday April 11, 2018 @05:56AM (#16809538)
from typing import List

a_list: List[T] = []

Visit https://docs.python.org/3/library/typing.html for more information.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by Osmium on Wednesday April 11, 2018 @05:54AM (#16809533)
> a_list: List[T] = []
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by umanwizard on Wednesday April 11, 2018 @05:55AM (#16809537)
a_list: List[T] = []
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by dagw on Wednesday April 11, 2018 @07:20AM (#16809965)
the GIL was not removed or at least a solid parallelism story was not included

Not for lack of trying. People have been trying to do this since at least python 1.4. They just haven't found a way of doing it without negatively affecting single threaded performance, which Guido considers an unacceptable trade-off. http://pyparallel.org is probably the most interesting latest experiment in this field, but it never got cross platform support and seems to have stalled out.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by oblio on Wednesday April 11, 2018 @08:04AM (#16810246)
They were breaking many things, maybe they should have rewritten the C API? From what I remember that's the blocker.

That would have broken all C extensions, but it's not like Python 3 at launch was a raving success regarding library porting.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by X-Istence on Wednesday April 11, 2018 @01:20PM (#16813331)
The C api isn't the blocker for removing the GIL. The blocker is that Python is a dynamic language and there is no good way to know if another thread has just changed the underlying function on an object or not without having fine grained locking.

Fine grained locking works, but is expensive for non-multithreaded applications and slows down Python. It would speed up multithreaded applications though.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by UncleEntity on Wednesday April 11, 2018 @11:34AM (#16812185)
They did break all C extensions in py3k -- not so bad you can't work around it with some preprocessor magic but break it they did.

And they continued to break them within the py3k lifetime, mostly unicode related stuff from what I can remember. Probably still break stuff but I haven't had time for my toy python projects in a while so haven't been messing with the C-API lately.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by oblio on Wednesday April 11, 2018 @11:48AM (#16812312)
We're actually agreeing here, I think.

I wished they had broken everything harder and once and for all, in order to fix the issue.

If there's going to be breakage anyway, people adjust their expectations. The scale is basically:

a lot of breakage > a bit of breakage >>>>>> no breakage.

Once you do break backwards compatibility, you might as well do it in a big way, provided you:

* don't offer vaporware for a decade (hello Perl 6!)

* try to offer some mitigations for the migration pain (auto-conversions, support libraries, top-notch docs, etc.)

* offer a great carrot at the end of the tunnel (good performance would be such a carrot)

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by dagw on Wednesday April 11, 2018 @08:22AM (#16810347)
Here's a video and HN thread that covers most of the current problems with removing the GIL:

https://news.ycombinator.com/item?id=11842779

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by jerf on Wednesday April 11, 2018 @09:14AM (#16810748)
"I say this because I'm a bit worried that long term Python has locked itself into a corner where it will keep getting pushed into as the other languages develop a better developer UX."

You can stop worrying. That is absolutely what will happen.

But it is a good thing. Languages should be something, not merely an accumulation of every fad and trend that appeared over its lifetime. That means eventually they will mature, and eventually hit a peak, and then fade. But during that process, at least you'll have a nice, mature language, instead of one always chasing the latest pretty-shiny, immature, confusing, crammed with too many features, with libraries constantly jerking around trying to keep up and always just a bit broken. Indeed, I kind of thing Python has already done a bit too much of the latter, and were I in charge of Python I'd give some serious attention to the idea of simply freezing the core language.

Python is what it is. Let it be what it is, because what it is is pretty good. It's by far my favorite language of the genre it is in. It's got way too much baggage to compete in the next arena, so let it be the master of the one it is in instead.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by username223 on Wednesday April 11, 2018 @01:44PM (#16813533)
> [Languages] will mature, and eventually hit a peak, and then fade.

"Maintenance mode" should be a badge of honor: you have created something that is a stable foundation for new things. For example, how many programming languages are implemented in anything other than C and/or themselves? Not a lot, and that's a huge compliment to C. Despite its faults, you can probably count on your C program working after you're dead.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by oblio on Wednesday April 11, 2018 @10:08AM (#16811199)
What's the last mainstream language that died? Even more so, what's the last mainstream language since the age of the internet that died?

Nothing truly dies anymore. It just lives as a ghost and haunts unfortunate journeymen.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by silval on Wednesday April 11, 2018 @10:08AM (#16811198)
> I think Python 3 was not brave enough, to be honest

Agree 100%. I would have added:

* fix the C API and pass the interpreter instance as the first parameter to all functions as is common in other interpreted languages, rather than relying on a global state.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by mjburgess on Wednesday April 11, 2018 @04:02AM (#16808979)
They didnt really "get away with it". But as far as Oracle, for example,doing something similar -- yes, open source languages get more of a pass.

Being an open community effort gives you a free-pass to make mistakes because you're methodologically sincere. Decisions are made by, and on behalf of, those who use the systems.

Having proprietary interests means you're methodologically insincere: mostly, you sell decisions for the developer but they are mostly for the company.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by oblio on Wednesday April 11, 2018 @05:09AM (#16809301)
Also the tech upgrade is free in terms of software license costs. Yes, those are generally dwarfed by time investments for tests, but still.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by nothrabannosir on Wednesday April 11, 2018 @04:10AM (#16809019)
Double standards by whom?? Every other article or comment I’ve read since basically py3+1y has been incredibly negative about it. The only positive news about Python, recently, seems from people who were not around since the py2 days. Data science is where it’s at now, but it used to be massive and ubiquitous. Golang came at a time where public perception of Python was down the drain, and ate a big chunk of its lunch.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by samastur on Wednesday April 11, 2018 @06:20AM (#16809636)
I've been around since ~1.5 and have no idea what you are talking about. I suspect our perception is very much coloured by where and whom you are hanging out with.

Agree that there was never a shortage of negative articles about py2/py3 transition. Fairly certain Golang success was down to its advantages more than Python's perception who's use has grown through all this time.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by ianamartin on Wednesday April 11, 2018 @12:15PM (#16812624)
My interpretation of the usage share is that Golang ate a bunch of lunch that would've otherwise gone to Python. That is, people moving from other languages (Perl, PhP) to something else for various reasons.

Absent Go, I suspect many current Gophers would've landed on Python. So in a sense, Python lost people to Go. But I've never seen anything to indicate that there was a large migration from Python to Go, and certainly not because of 2 to 3 or public perception--whatever that means in the context of a programming language.

Python 2 is still the mainstay for Data Scientists. I've seen more resistance to moving to 3 there than almost anywhere. Which is pretty funny because it's the easiest code to port assuming your data science libs support 3 (and all the big ones do.)

I think it's more accurate to say that Go ended up with some of Python's potential mindshare, not that it stole a significant amount of existing mindshare.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by goatlover on Wednesday April 11, 2018 @08:34AM (#16810425)
> and ate a big chunk of its lunch

Pretty sure that's not true. Golang might have taken some from Python web frameworks or command line tools, but that's about it. Python's popularity in scientific computing has only grown over time, and that encompasses a lot of fields and users, not just data science.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by mhd on Wednesday April 11, 2018 @04:10AM (#16809023)
Wasn't there a big brouhaha over the change from VB6 to VB.Net? The big difference there is that if it's ordained from your corporate overlords, you have little choice, whereas you feel like you've got a bigger right to complain when it's "just" coming from the BDFL.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by umanwizard on Wednesday April 11, 2018 @05:57AM (#16809542)
VB.NET is a totally new language almost unrelated to VB6. That’s like talking about C vs C++, not py2 vs py3.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by toyg on Wednesday April 11, 2018 @07:57AM (#16810212)
Calling it a “New language” flatters Vb.net. In reality, it was a “marketing compatibility shim” on top of C# to help VB developers acclimatise to the CLR.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by michaelt on Wednesday April 11, 2018 @06:11AM (#16809602)
As VB6 is compiled, you don't need your users to have a particular interpreter version installed.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by ajdlinux on Wednesday April 11, 2018 @06:16AM (#16809618)
I do remember the good old days of having to make sure you had MSVBVM50.DLL or MSVBVM60.DLL in the right place...
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by pjmlp on Wednesday April 11, 2018 @07:16AM (#16809934)
It is no different than ensuring you have the right libc.so in place.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by sorisos on Wednesday April 11, 2018 @04:03AM (#16808985)
Many languages seem to suffer from legacy support. C++ and PHP for example. The double standard might be the only way to avoid this!?
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by pjc50 on Wednesday April 11, 2018 @04:25AM (#16809093)
The legacy support is a benefit for people who are still using it.

The lesson from both Perl and Python is clear: you cannot remove language features - if you do you're creating a new language which has to start from zero in adoption.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by b2gills on Friday April 20, 2018 @03:10PM (#16887659)
Perl 6 removes very few language features. About the only notable ones I can think of is fork and format. Since Perl 6 has built-in multithreading, fork is not needed. And hardly anyone uses format anymore (it is great for directly printing to a line printer).

What Perl 6 did is change the syntax for various features of Perl 5; while adding a lot of new features.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by jnwatson on Wednesday April 11, 2018 @04:43AM (#16809178)
I guess you haven’t looked at Swift. All 4 major versions are very incompatible.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by imtringued on Wednesday April 11, 2018 @10:06AM (#16811176)
It's still a young language and doesn't have as much legacy codebases as python.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by tjalfi on Wednesday April 11, 2018 @10:59AM (#16811694)
Xcode also has tooling support that will handle a lot of the language conversion for you.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by Y_Y on Wednesday April 11, 2018 @04:08AM (#16809008)
Not to mention the loss of tuple unpacking in function signatures. Even if i felt morally wrong about it, for the last few years I've been writing python2 with a few `from __future__`s at the top since it was fastest and most featureful and had all the libraries.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by ChrisSD on Wednesday April 11, 2018 @04:23AM (#16809082)
I'm not sure that tuple unpacking in function signatures is any great loss. It's a feature I hardly ever saw used and if you do need to unpack an argument then you can do so in the first line of the function's code.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by dx034 on Wednesday April 11, 2018 @04:42AM (#16809173)
I saw it used a lot and it caused hours of rewrites to get libraries python3 ready. It's one of those things where I wonder why they didn't just depreciate it for another few iterations, allowing scripts to be changed over time.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by ChrisSD on Wednesday April 11, 2018 @05:36AM (#16809435)
The 2to3 tool will rewrite it automatically. It's not something that requires manual intervention.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by dralley on Wednesday April 11, 2018 @07:46AM (#16810139)
Oh ho ho, it is _not_ that simple.

Any code with a lot of assumptions about text encoding or integer division is going to be terribly broken after 2to3. It very much does require manual intervention unless you're doing very simple scripts.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by ChrisSD on Wednesday April 11, 2018 @07:55AM (#16810195)
Sure but the 2to3 tool allows you to run the tuple_params fixer on its own. Text encoding and integer division are separate issues and have nothing to do with unpacking tuples in function arguments.

My point in this conversation has been that this feature doesn't require manual rewrites. And I'd add that in any case the deprecation period for python 2 will have been 12 years once Python 2 reaches EOL. That's plenty of time to update a code base.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by arunix on Wednesday April 11, 2018 @08:28AM (#16810386)
In case anyone wonders why tuple unpacking was removed:

https://www.python.org/dev/peps/pep-3113/#why-they-should-go

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by pbalau on Wednesday April 11, 2018 @09:58AM (#16811103)
Php3 and php4? Php4 and 5? Then I've lost contact with pure php
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by est on Wednesday April 11, 2018 @04:58AM (#16809249)
> No other living language could have gotten away with such ridiculous fragmentation and perf regression for such a long period of time

FTFY. Just think about Perl6, Lua5.3 and VB.NET

I am pretty sure somewhere in this world a miserable soul has to maintain a Ruby1.8 codebase.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by ggm on Wednesday April 11, 2018 @03:59AM (#16808957)
Perl6
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by BjoernKW on Wednesday April 11, 2018 @04:05AM (#16808990)
Well, they didn't really get away with it.

Perl isn't as widely used as it used to be. Besides, in spite of the name Perl6 isn't compatible with Perl5 but rather a completely new language.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by labster on Wednesday April 11, 2018 @04:35AM (#16809147)
Perl 6 is a completely new language, but that doesn't mean it's incompatible. Inline::Perl5 provides a rather extensive compatibility layer with Perl 5: https://github.com/niner/Inline-Perl5
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by peteretep on Wednesday April 11, 2018 @05:17AM (#16809334)
By this logic, Perl is also compatible with the many other languages for which there are Inline:: modules.
Re:Python 2 will be replaced with Python 3 in the next RHEL ... by raiph on Monday April 16, 2018 @10:03PM (#16854816)
The Perl 6 Inline::Perl5 automatically maps Perl 5's syntax, object system semantics, exceptions, etc. to Perl 6's so that Perl 6 users don't in principle have to know about Perl 5, just the logical API of any used module/library/function.

I don't think the Perl 5 inlines do this.

Re:Python 2 will be replaced with Python 3 in the next RHEL ... by mateuszf on Wednesday April 11, 2018 @04:01AM (#16808972)
Perl6 is not as widely used as Python 3. Also it's practically a new language in comparison to Perl5.