Live data from Hacker News

Python has brought computer programming to a vast new audience

economist.com

171–180 of 268 posts

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

#171
post #152

Earlier quoted context omitted.

1). C++/Arduino for micro controllers ends up using more memory than micropython. I've managed to get the binary sizes to 1/4 by doing cross compiles and linking things my self. 2). Types hints are a terrible non-pythonic kludge to solve a people problem in code. People who want to write java with whitespace and no curly brackets love them. CPython has made a number of bad decisions lately that make the language less…

> Types hints are a terrible non-pythonic kludge to solve a people problem in code. I have a love/hate relationship with type hinting in Python. I've been using them for about 2 years, and it still just feels... unnatural. I usually add enough so that my IDE (PyCharm) has better autocomplete and that any Sphinx generated docs have sufficient coverage of types I may have missed when adding @params.

I have mostly a hate relationship with them, because the people who use them do not write python. They write c# or java in python.

And you shouldn't need an IDE with a scripting language. That one of the main selling points for type hints has been "Your IDE will do things for you!" is a warning that this is a bad move. Again python is not java, and it shouldn't be trying to be java.

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

#172
post #30

> But in the past 12 months Google users in America have searched for Python more often than for Kim Kardashian, a reality-TV star. This seemed so unlikely that I thought the Economist had incorrectly used the Google Trends comparison tool, but they are right: https://trends.google.com/trends/explore?geo=US&q=%2Fm%2F05z... The gap is even bigger when you consider a worldwide audience (i.e. one less focused on America…

To be fair, a single python dev is going to search for queries about python dozens of times per day. Even the most ardent Kardashian fan is unlikely to search for Kardashians in any volume even close to that.

If we're using Google to approximate mind share them it's skewed way farther than that. Nobody who follows the then is sitting doing Google searches. They're already following them on Snapchat, Facebook, Insta, and Twitter.

You only get searches with breaking tmz news.

... I say this with detailed observations of my girlfriend's media habits.

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

#173
post #153

Earlier quoted context omitted.

abstract base class != interface

Right, they're even better than Interfaces: both a contract and a partial implementation. No need for an "Interface" when you've got ABCs.

I see what you mean, but to me abstract classes are distinct from interfaces. Abstract class answers the question "what an object is?", whereas an interface is about what the object can do.

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

#174

Earlier quoted context omitted.

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:/…

:set ts=8 sts=0 sw=8 expandtab I have secrets.

Thank you for this. I've been typing out:

:set tabstop=4

:set shiftwidth=4

:set expandtab

Like a pleb for years. What's sts?

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

#175
post #158

Earlier quoted context omitted.

> The evidence is in the usage... It's possible it was not adopted because there's a cost involved in every feature that has inconsistent support across runtime. The benefit needs to outweigh that cost. > Putting the expression first makes the language more declarative The case for a specific order makes less sense in a declarative language, not more. And: [1,2,3,4].map((x) => x * 2) Doesn't seem substantially more o…

Listen to how people who don't program describe the task of transforming each element of something. In my experience they often say something along the lines of, "I want y for each x in z," rather than, "For each x in z, I want y." The latter is more common among people who've been programming in certain languages, not the average person. I don't have systematic data collection for this, just personal experience. But…

> Listen to how people who don't program describe the task of transforming each element of something. In my experience they often say something along the lines of, "I want y for each x in z," rather than, "For each x in z, I want y."

If we're really at the point where we're arguing between which clause order (among other potential variations in expression) is more natural across most natural language speakers, that should about wrap it up.

But to the extent that it doesn't, this assertion has the merit that it sounds like an empirically verifiable position.

> Ask some random person off the street to read your source code.

Which is worth considering, I suppose, in situations where the relevant software is being built by people being brought in off the street.

> [SQL] is exactly the domain we're talking about when discussing comprehensions.

"Exactly" overstates the case. As I said above, I recognize it's a related domain, but there's plenty of things that are easier to do with Python or Javascript than they are in SQL, even specifically with operations over every tuple in a set.

And again, declarative == easier is overgeneral assumption. Take Prolog, for example. Definitely domain-overlapped with SQL, often a poster child for declarative. I quite like it myself, but it's not always a hit at parties. Even hackathon parties.

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

#176

Earlier quoted context omitted.

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:/…

I'd never seen that before!

She's obviously the smarter one: Vim and (4) Spaces ftw.

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

#177

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 arca…

I've found it very difficult to "self-contain" python projects that are even of modest size. Anaconda is a mediocre solution that is the best among other terrible options.

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

#178

Someone else said this on HN: Python is the second best language in almost every field of computing. That's why there's a library for everything in Python. It's limitations are also not terrible for most people. If you want super fast, you will know how to do that some other way. If you just want simple and easy to read, you use Python.

> Someone else said this on HN: Python is the second best language in almost every field of computing.

It isn't. Frankly, it isn't even top 3 in any "field of computing" depending on how you define "field of computing".

What python has going for it is the evangelists who do a great job of spreading the word and of course funding - they have lots of money backing the language. Also, being an interpreted language, it has a much lower barrier to entry.

I'm not much of a fan of python and its block syntax - I very much prefer braces or markers delineating the beginning and end of code blocks.

Also, python wants to be everything ( functional, OO, imperative, etc ) and hence is the worst language to learn programming language topics in my humble opinion.

My hope is that python will serve as a "gateway drug" to other languages like ruby, ML, C/C++, SQL, etc. So that people will learn what programming and languages are rather using python as a glorified calculator which I'm sure many are doing.

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

#179
post #102
post #52

Earlier quoted context omitted.

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 concept…

Private doesn't mean much. You can still access private members in Java using reflection.

This hole is incrementally being closed with the introduction of Java 9's modle system. You can only deep reflect into classes in your modules or those "open" to you.

There are both declaritive and command line param ways to open things so it's not as rigid as it sounds.

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

#180
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…

I'm going to chime in to 100% agree with you. I'm a big fan of both of those languages and their respective ecosystems.

I'm in love with the idea that there a good case of polyglot (biglot?) program synergy between the two. Keep your eyes open on Jython and GraalPython!

Post reply on HN