Hacker News new | ask | show | jobs
by ayrx 3492 days ago
> Currently you cannot run Python 2 inside the Python 3 virtual machine. Since I cannot, that means Python 3 is not Turing Complete and should not be used by anyone.

I stopped there.

12 comments

A programming language "is said to be Turing complete or computationally universal if it can be used to simulate any single-taped Turing machine" [1]. This author doesn't seem to understand this concept properly.

[1] https://en.wikipedia.org/wiki/Turing_completeness

And if he doesn't understand that concept should he _really_ be teaching anyone programming?
I'm pretty sure that if you understand both Turing completeness and the practice of actual programming, then you know that in most cases the one has virtually nothing to do with the other. (Which is not meant at all to imply that the author of linked article understands Turing completeness, just that even though he doesn't seem to he could still be excellent at teaching programming.)
Then the question becomes "why is he talking about turing completeness, something that is either irrelevant, or that he knows nothing about?"
I mean it sounds very nice and fancy - but loop semantics and conditional jumps have nearly nothing to do with what he's talking about.
Heck no he shouldn't.
I'm pretty sure this was a tongue-in-cheek way of stating the true criticism.
I'm wondering that here. The whole article feels over-the-top, perhaps it's a well crafted parody, an extreme sense of sarcasm? May be he is a Python 3 lover after all.
Isn't over-the-top Zed Shaw's "thing"?
Ditto.

Then I read more for laughs.

I kind of feel like I could fix py2to3 if I have a sed and awk layer in there.. maybe a fun project.

In my experience a lot of the problems with automatically converting existing Python 2 code to Python 3 code is that the Python 2 code usually makes fundamentally broken assumptions when it comes to unicode and bytes.
This is what the author doesn't get- the fact that Python 2 makes no distinction between bytes-like objects and string-like objects is a bug, not a feature. He finds his code so awful to migrate because he has built it on a contrary assumption.
I was working on a side project and ended up upgrading because I could figure out how Python was encoding my data. I got so frustrated with the semantics I found it easier to jusy upgrade.
lol, winning.
Definitely disagree. I am a literal genius, wrote compilers, learned a dozen programming languages for fun, but prefer to do hard things. Yes p2 handling of coding is broken, but p3 is much worse. Making a theoretical argument about a pragmatic problem is a category mistake. And it's not even the core of Zed's expressed concern, which is the arrogant and abusive manipulation of the user community in service of the interests of self-obsessed project.
such smart. impressed. "p2" "p3". knows unique terminology. literal genius. so smart. A dozen programming languages just for fun? You definitely know what you're talking about and have very worthwhile contributions. People should listen to you.

I like what you said about self-obsessed project. It's clear that you have a very well reasoned position, not just opinion. What you say makes irrefutable sense.

I also can't run Python 2 by passing it into a C compiler. Man, I should publish a paper on this- they thought C was Turing-complete, but I proved them wrong!
Considering how C has been targeted for all sorts of nonsense, I suspect that your argument would be somehow used as irrefutable proof that C is outdated and deprecated.

At least that's the conclusion that is repeatedly forced upon C, no matter what the argument is.

Stop, it hurts. Too much.
Yea I skimmed the rest. This makes me ashamed that I even bought the guys book (Learn Python the Hard Way). His attitude is what is going to kill python, not python 3. I moved from Perl 5 to Python 3 hoping to flee the internal dev fighting and attitudes, yet here I am again.

I'll say this, at Pycon 2016 I attended some dev sprints/hackathons with the python 3 developers. Python 2 is no where on their radar, its dead. They have moved on. There will be no additional compatibility layers or any of that. All of the mainline libraries that everyone uses (django, sql alchemy, etc ) have moved on to python 3. If you haven't, you should to.

> His attitude is what is going to kill python

No. The rest of the community is much better. In fact, his behavior is an aberration.

Pypy hasn't
http://pypy.org/download.html

py3.3 support is at alpha level. py3.5 support is in the pipeline and already available for testing. It's unlikely they'll do any effort that's targeting py2 specifically anymore.

Being in alpha isn't exactly 'having moved on' ;-)
But there is a plan and the milestones are being achieved.
First I spit my coffee when I read that too, but let me play devil's advocate (because I pretty much disagree with the entirety of his rant) : he's pointing out that since it's technically feasible to write a Python 2 interpreter in Python 3, and since it should even be pretty easy since the two languages do not differ immensely, then the only reason why it hasn't been done and there's no -2 flag to python3 has to be an ideological reason, a manipulation by the core devs to impose their ideas by force.

It's extremely badly conveyed but that's what I got out of it by keeping reading.

I do disagree with him on all the rest though, especially strings. It didn't "just work" before, it failed silently and who knows how much disaster he or his readers have caused because of it. Now at least you can't be wrong anymore. For a language heavily used on the web, it's hugely important to understand where your strings are coming from and where they're going to, and how.

Besides, Python is not a frigging "beginners language". Just because Python (and admittedly especially Python 2) is generally easy to grasp as a first language doesn't mean it's its purpose, nor should it constrain itself toward this goal. It's used in a million of different areas, including pretty sensitive ones. It's now become a more mature language, reaching for exactitude and consistency. Just because Zac no longer has an easy toy language to point script kiddies to so they can "learn to program" by reading one website doesn't mean Python is to blame.

Yes, the author doesn't know what he's talking about.

But people talking about Turing completeness in a real programming language (usually in the form of "x is Turing complete, therefore you couldn't ask for more") almost always haven't got a clue.

> But people talking about Turing completeness in a real programming language (usually in the form of "x is Turing complete, therefore you couldn't ask for more") almost always haven't got a clue.

There is a fun quote about that...

"There are those who tell us that any choice from among theoretically-equivalent alternatives is merely a question of taste. These are the people who bring up the Strong Church-Turing Thesis in discussions of programming languages meant for use by humans. They are malicious idiots. The only punishment which could stand a chance at reforming these miscreants into decent people would be a year or two at hard labor. And not just any kind of hard labor: specifically, carrying out long division using Roman numerals. A merciful tyrant would give these wretches the option of a firing squad. Those among these criminals against mathematics who prove unrepentant in their final hours would be asked to prove the Turing-equivalence of a spoon to a shovel as they dig their graves."

-- Stanislav Datskovskiy

I just point them towards Unlambda. Turing completeness in three characters (plus one for output)

http://www.madore.org/~david/programs/unlambda/#what_is

Unlambda as a language may be a joke (the funny kind), but learning it is incredibly enlightening, and makes you understand some fundamental concepts of computer science.

As such, I think it represents one of the most enlightening esoteric languages out there together with Brainfuck.

True. No programming language has infinite tape.
Actually some kinda does:

"Garbage collection is simulating a computer with an infinite amount of memory". https://blogs.msdn.microsoft.com/oldnewthing/20100809-00/?p=...

We both agree, I'm just using this as a pretext to share this intriguing piece of knowledge. I find the concept much more intuitive than "getting back unused memory".

Especially when you look at the 90% memory usage on your OS, it still make sense with the "infinite memory simulation" definition.

> THERE IS A HIGH PROBABILITY THAT PYTHON 3 IS SUCH A FAILURE IT WILL KILL PYTHON.

I stopped there.

Isn't this what killed perl?
Correct me if I'm wrong, but the idea of perl6 was announced in 2000, and perl6 was finally published in 2015. So there was a 15 year gap when perl5 was perceived on its way to become obsolete, but perl6 was not available.

I am unsure when the idea of python3 (first as python 3000) came to general knowledge, but it must have been some time between 2000 and 2004. Then python3 was published in 2008.

So the time between obsoleting the old version, before the new version was available, was notably shorter with python.

I thought there was a release in the interim that broke backwards compatibility and the went back to the drawing board. But it's that long ago I might be confusing it with Netscape.

There's also a good chance I'm confusing perl and parrot.

Perl is alive and well, thank you.
I think it would be more accurate to say that it is alive but largely forgotten. Perl6 is very cool, but has not gained much traction.
Sure, it's just resting.
No, that's Parrot.
From the article:

> Python 3 has been purposefully crippled to prevent Python 2's execution alongside Python 3 for someone's professional or ideological gain.

I can't tell if Zed's referring to python3 doing a fork()/exec() of a python2 not working correctly or if he wants/expects some kind of inter-language import or "linking" among files written for respective language versions. What's he getting at?

Is there really something that prevents you from executing python2 at the same time as python3? (I tried a simple program "os.system('python3 -c \'print ("hello")\'')" and it worked just fine.

I'm pretty sure what he wants to say is that it should let you use libraries written for an older version of Python than you are using, much like the CLR would do if you wanted to use a library written using an older version of C# than you're using (or a different language targeting the CLR, for that matter). I'm pretty sure the claim that Python 3 is "not Turing-complete" is just a hyperbolic mockery of the claim that that isn't possible to do.

N.B.: I haven't worked with Python so if you can actually do this somehow let me just say that that's not the impression the article left me with.

This is doubly wrong as PyPy which runs Python 2.7 works in CPython 3.
I came here to post this. What?
I did the same. I honestly wonder if there is a single other developer on earth who is troubled by the inability to write a Python 2 runtime in Python 3.
Same. That's when I came back for the comments on HN
same. i can't tell if he's serious or not and i don't really care.
Then you missed his crazy notion of what static typing is and his failure to understand the difference between a string and a byte sequence. It's incredible that someone who knows so dangerously little about Unicode has written a web server that is so popular in the Ruby community. It says something about the quality of the language's ecosystem.