Live data from Hacker News

Someday we will all program in Python

davidbau.com

41–50 of 80 posts

Re: Someday we will all program in Python

#41
post #34

The less the programmer says, the more flexibility the compiler has to speed things up. I seriously doubt it. The more the compiler knows, the more it can optimize things. What it's "daily" in this example? It could be anything. The only thing the compiler knows at compile time is that it should generate some lookups searching and calling the functions "__iter__", "__slice__", etc... Put that line into a function whi…

Also... The more the runtime knows, the more it can optimize away (JIT).

Re: Someday we will all program in Python

#43
post #10

Earlier quoted context omitted.

> The only reason to write in a language like C or Java today (over Python) is speed. Do you really believe that?

What are some other benefits of C or Java over something like Ruby and Python?

The level of abstraction matches most hardware.

Not all code written in C is performance-critical. But sometimes it's still the best choice if your code is directly talking to hardware.

Re: Someday we will all program in Python

#44
post #40
post #36

Earlier quoted context omitted.

"There's no question that Linux should be written in a low level language" In the early days, the fact Unix was written in C was quite remarkable. At that time, OSs were written in hand-optimized assembly language. I see no reason to stay with C-level languages (C was once called high-level) if we can make compilers that translate them into machine code that's faster than hand-optimized assembly. Smalltalk/80 and the…

But those machines (Smalltalk, Lisp) had dedicated HW dealing with gc, special instructions, etc.

I remember being a fly on the wall at a discussion between several very smart VM guys at Camp Smalltalk maybe 7 or 8 years ago. (VisualWorks, Smalltalk/X, Smalltalk Agents, Squeak, Dolphin.) Apparently, there's a lot of stuff chip makers could put in to general-purpose processors to generically support High Level languages. I think it's high time we had some of this, given the prevalence of Java, Perl, Python, Ruby, PHP (yes, it would benefit them too).

Re: Someday we will all program in Python

#45

The only reason to write in a language like C or Java today (over Python) is speed. And there are a very limited number of applications that require that sort of speed. There's no question that Linux should be written in a low level language, or a high-performance chess bot. But I'm incredulous when I see anyone write a website in even the relatively high-level Java. So, the author is right that we're getting more Py…

[deleted]

Re: Someday we will all program in Python

#46
post #22

Earlier quoted context omitted.

Some day, something like Python will be the fast low level language, there will be new slower languages that are easier to use than Python, and C will be a memory. There are Smalltalks that ditched (in one case all) their "primitive" methods written in C against the VM internals because the JIT compiler turned out to be good enough. (Agents for the all case. VisualWorks also lets much of the Dictionary functionality…

We are dealing with "poky" high level languages like Ruby and Python because a lot of us find Lisp, Smalltalk and Self horrendous to work with. Ruby in particular is basically Smalltalk + Lisp for regular people - it's taken a good chunk of the concepts and packaged it in a way more people are happy to work with. First time I read about Scheme I was fascinated. Until I played with it a while and put it away and promp…

> We are dealing with "poky" high level languages like Ruby and Python because a lot of us find Lisp, Smalltalk and Self horrendous to work with.

I think that's the main problem. There are lots of "Lisps" out there besides Common Lisp (which is what most people think of when they hear "lisp"). I.e. Scheme, newLISP, and Clojure come to mind.

Pick one of those three Lisps and learn it, you'll be wondering why anyone in their right mind would consider writing in any other language, unless it was a lisp. As someone once said, there's a reason people become Lisp zealots; just take a look at it.

Re: Someday we will all program in Python

#47
post #14

I thought the second comment was interesting: >I believe the flaw in the argument is that the higher-level languages are actually more constrained, because they have made too many broad promises and are unable to tell when they can violate them without ill effect, even though it is obvious to the programmer. We might think that your example above would be a perfect case in which we could parallelize the loop... but w…

Which is exactly why Fortran compilers are still faster than C++.

Re: Someday we will all program in Python

#48
post #8

Earlier quoted context omitted.

Is this better? map(partial(reduce, +), partition(7, 7, daily)) Personally I'd be much much more happy to be using this code than the snippet in the article. In fact, I don't program Python regularly and it did take quite a while to figure out what was going on in the code. weekly = [sum(daily[j:j+7]) for j in range(0, len(daily), 7)] Now if you look back at the top snippet, its just normal function calls, so you can…

Just because you already happen to have a certain function at your disposal doesn't mean your language is suddenly superior. def partition(n, step, coll): for i in range(0, len(coll), step): yield coll[i:i+n] allows weekly = [sum(week) for week in partition(7, 7, daily)] Using Python's map() function you can even do map(sum, partition(7, 7, daily)) making it exactly the same as your example. And no, I probably haven'…

> Just because you already happen to have a certain function at your disposal doesn't mean your language is suddenly superior.

You are certainly correct in that. That's not what makes Lisps superior to all other languages though, "it's the syntax stupid."

Edit: Sorry, I know that comment appears trollish (and it is), what I meant to say is that unlike Python, Lisp(s) have virtually no syntax, and are more powerful because they treat code as data. It would take me a blog post to explain why that's important, but if you give the language a shot you will see why that is (and compare how long it takes you to learn it to how long it took you to learn Python!).

Re: Someday we will all program in Python

#49
post #31
post #9

Earlier quoted context omitted.

That could be said for any language. It's just that the first language someone usually learns borrows more from algol than from lisp. This leads to the idea that Python/Ruby/PHP/Javascript are easier to learn than Clojure/Common Lisp/Scheme.

Python/Ruby/PHP/Javascript are easier to learn because most people already know a similar language. Just because it seems unfair doesn't mean it's not true.

Python and Ruby do one particular thing right that Smalltalk didn't:

Operator Precedence for Algebras.

Implementing an Algebra is a very important thing for a language to be good at. Being able to use algebras without having to switch mental gears is a good thing for scientists, mathematicians, and technical people of all stripes.

IMHO, the ability to easily implement your own algebra is a hallmark of a great language. Having that with the operator precedence is a bit of very justified syntactic sugar.

Re: Someday we will all program in Python

#50

The only reason to write in a language like C or Java today (over Python) is speed. And there are a very limited number of applications that require that sort of speed. There's no question that Linux should be written in a low level language, or a high-performance chess bot. But I'm incredulous when I see anyone write a website in even the relatively high-level Java. So, the author is right that we're getting more Py…

The only reason to write in a language like C or Java today (over Python) is speed. And there are a very limited number of applications that require that sort of speed You probably mean a very limited number of web app frontend code. That may be true. But I think you underestimate what is being done with software. With a language that is 200 times slower than C or Java you can't do any data analysis, graphics or imag…

Can we at least all agree that no one should be writing anything in a shell scripting language any longer?

I'd be happy with just winning that battle.

Post reply on HN