Live data from Hacker News

Python has brought computer programming to a vast new audience

economist.com

51–60 of 268 posts

Re: Python has brought computer programming to a vast new audience

#51
Python's core strength, among the half dozen of language I used in daily work, is that it is simple and focus on easy human expressiveness.

It is the best example of 'simple is hard' when done right. Its core abstractions are carefully selected and weaved in a way, using them to organize/orchestrate your thoughts is just natural and fluid.

Huge thanks to Guido for presenting the world such a meticulously crafted work.

Re: Python has brought computer programming to a vast new audience

#52
post #15

Python is a great language to start programming in. My biggest frustration with traditional programming languages (well, C/Java mostly) was just how much upfront effort and understand is required to do useful stuff. Whereas with python it is pretty easy to whip up a script, read input and transform it into output in real time etc. That said, I think its also important for Python programmers to dabble at least a littl…

Other than interfaces and generics (which would make no sense to add in Python, since it's dynamically typed), can you name some OOP features Java has that Python doesn't have?

This may sound super n00b but I really like that Java is explicit about everything. So for instance, you explicitly specify variables, methods as private with the keyword 'private'. In python you have to use an underscore, and its still not really private, its obfuscated. That's just one example, but in general I really like that kind of by-the-book verbosity, instead of having to mentally map it into the OOP concepts.

Re: Python has brought computer programming to a vast new audience

#53

Read the comments here. Look at the diversity of opinions and the number of them that, while professing love for Python, directly contradict each other. Python is verbose|concise, simple|advanced, disciplined|experimental, modern|classical. It goes to show: something doesn't need to be actually-better. It doesn't need to be actually-simpler. It doesn't need to make your job easier or better. It needs to make people t…

> It goes to show: something doesn't need to be actually-better. It doesn't need to be actually-simpler. It doesn't need to make your job easier or better. It needs to make people think it does that.

I don't agree with that takeaway. You ask us to consider all the diversity of opinions here, but then you evaluate them out of context, what one person says about Python is not necessarily in reference to the metrics that another has laid out, hence, they don't "directly contradict each other".

To claim that "oh you all just think Python is less verbose than Java, but it's all hype and no fact" is utter absurdity. You seem to have had bad experience that make you think Pythonistas are the tech world's Jehovah Witnesses, when plenty of other programmers will make the same case against Javascript (especially in the Node.js context).

Why do you think Python, or any programming language, has to be "revolutionary" -- or engage in cultmindthink -- for it to become popular?

edit: added "or engage in cultmindthink"

Re: Python has brought computer programming to a vast new audience

#54

The thing I love most about the language is its conciseness, on several levels. It's syntactically concise because of its use of whitespace and indentation instead of curly braces. Expressions are often concise because of things like list slicing and list expressions. It can be linguistically concise, because it is so easy to fiddle with the data model of your classes, to customize their behavior at a deeper level. F…

I went through a course in python about a decade ago and I enjoyed it! Then along the way, I picked it up here and there. Then used it at work for a few months to sort through a lot of data.

Recently I started trying to learn swift through the Stanford course. And the curly brackets confused the heck out of me. They still do! They just seem to pop up out of nowhere. All to say , I completely agree with your second paragraph. Python is very concise.

Re: Python has brought computer programming to a vast new audience

#55

Am I the only who thinks that "90% of American parents want their kids to be computer scientists" is rather unsettling? The market is currently full of people who are in for the money and will continue to be. It will be filled with people until supply meets demand. That the salaries will drop significantly is a natural result of this. We had this pork cycle for teachers, doctors and other highly trained people. No on…

Is there strong evidence that this will happen anytime soon? I've heard many arguments that claim this wouldn't happen anytime soon, particularly because of the level of difficulty and the required determination.

Re: Python has brought computer programming to a vast new audience

#56

I remember hating the whitespace thing so much when I started with Python circa 2.4, but have really come to love the language in a lot of domains since then. A huge, huge "thank you" to Mr. van Rossum for creating this quirky language that I've become so fond of and for the countless hours of his life he's given to the project.

from __future__ import braces I hated the white-space thing until I discovered that. For whatever reason this made me get over myself and learn to love the tab/space argument that is somewhat akin to the vi/emacs argument.

Oh, I see. I use spaces and vim (I do, but who cares). Let's start a flamewar. /s

Every time I think about tabs/spaces, I think about that episode in Silicon Valley [1]. Hilariously accurate, I have the exact same feeling when somebody uses the mouse to copy something or navigate. The cringe makes me feel alive (I guess this is the ultimate reason for those flamewars. And neurotic tendencies, of course).

[1]: https://youtu.be/SsoOG6ZeyUI

Re: Python has brought computer programming to a vast new audience

#57
post #6

Earlier quoted context omitted.

Can you explain implicit type conversions problems in python?

It is not a problem, it was just non expected behavior for someone trained in strong typed languages. For example, you want to calculate the performance of your ML algorithm by counting the correct predictions / total. My expectation was that the result of a division of integers, would be a float, specially if the modulo is not 0.

In what strongly typed language does the division of two integers result in a float?

Re: Python has brought computer programming to a vast new audience

#58

The thing I love most about the language is its conciseness, on several levels. It's syntactically concise because of its use of whitespace and indentation instead of curly braces. Expressions are often concise because of things like list slicing and list expressions. It can be linguistically concise, because it is so easy to fiddle with the data model of your classes, to customize their behavior at a deeper level. F…

It's also nicely self-contained, especially if you use a distribution like Anaconda. You don't have to spend hours fighting with the configuration and tooling. It's also very easy to debug and step through code using Spyder, which is similar to MATLAB. It makes it easy for someone who is smart and generally competent with computers to be productive in a short amount of time without first amassing huge amounts of arcane knowledge-- knowledge that isn't actually helpful to making working code!

Re: Python has brought computer programming to a vast new audience

#59

The thing I love most about the language is its conciseness, on several levels. It's syntactically concise because of its use of whitespace and indentation instead of curly braces. Expressions are often concise because of things like list slicing and list expressions. It can be linguistically concise, because it is so easy to fiddle with the data model of your classes, to customize their behavior at a deeper level. F…

> My big regret with Python 3.0 is that the scoping rules in list expressions changed to prohibit modification of variables in surrounding scope. This degraded the utility of list expressions. The work around is so long-winded. Can you elaborate? I'm not sure what this is referring to.

In Python 2.x the loop variable is part of the containing scope:

  >>> a
  Traceback (most recent call last):
    File "", line 1, in 
  NameError: name 'a' is not defined
  >>> [a*2 for a in (1,2,3)]
  [2, 4, 6]
  >>> a
  3
In Python 3.x, it is not:

  >>> a
  Traceback (most recent call last):
    File "", line 1, in 
  NameError: name 'a' is not defined
  >>> [a*2 for a in (1,2,3)]
  [2, 4, 6]
  >>> a
  Traceback (most recent call last):
    File "", line 1, in 
  NameError: name 'a' is not defined
It is sometimes useful to know why something failed. The following Python 2 code will not work in Python 3:

  >>> import math
  >>> try:
  ...   values = [math.sqrt(x) for x in (1, 2, -3, 4)]
  ... except ValueError:
  ...   print("cannot compute sqrt(%r)" % x)
  ...
  cannot compute sqrt(-3)
I have mostly found this feature of Python 2 to be useful on the interactive shell, when trying to diagnose what caused an error in my list comprehension. Eg.

  >>> with open("tmp.dat") as input_file:
  ...   fields = [line.split()[3] for line in input_file]
  ...
  Traceback (most recent call last):
    File "", line 2, in 
  IndexError: list index out of range
  >>> line
  'one two three\n'
Oops, there are only 3 columns, not 4.

Re: Python has brought computer programming to a vast new audience

#60

Read the comments here. Look at the diversity of opinions and the number of them that, while professing love for Python, directly contradict each other. Python is verbose|concise, simple|advanced, disciplined|experimental, modern|classical. It goes to show: something doesn't need to be actually-better. It doesn't need to be actually-simpler. It doesn't need to make your job easier or better. It needs to make people t…

Not all of those are contradictory. For example, Python mostly stays away from cryptic syntax and implicit behavior, making it verbose, but it finds powerful ways to express common patterns, making it concise. You get a small amount of readable explicit code. The words are antonyms if you pick their meanings carefully, but they don't have to be.

Python's design isn't revolutionary, but it's good and the language happened to become popular. So it's not just well-designed, but it also has all the libraries and resources and network effects that you don't get just from having a well-designed language. I'm sure a lot of it was dumb luck, but I like the result.

JavaScript's design had much less impact on its success than Python's design did on Python's success. It was doing the right thing in the right place at the right time, and how it did that wasn't all that important - once it turned into a web standard it wasn't going away.

Post reply on HN