Live data from Hacker News

Python has brought computer programming to a vast new audience

economist.com

141–150 of 268 posts

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

#141

Earlier quoted context omitted.

> I believe SQL is "the most deployed programming environment family in human history". SQLite is seemingly everywhere. How many computers have a browser on them vs an interactive and instructable version of an SQL server?

You'll need to define some terms here. What is a "programming environment family"? Does BASIC in its various forms count? That includes Visual Basic and VBA. Do people need to use it, or could it just be sitting there, like BASICA.EXE on an old MS-DOS distribution? For that matter, the DOS shell is still hanging on, and it's a programming environment. Most people use browsers on a smart phone or pad, with (as I under…

I think that BASIC might actually be the dark horse I haven't considered here! Nice! I wonder if the fact that it isn't shipped on the other platforms evens that out though.

I just pulled out my surface book and Basic doesn't seem to be on my command line. I wonder if that's unique.

> SQLite is not a server.

Did I imply it was? SQLite is not a programming environment when shipped, either. An SQL server with a sufficiently large editor buffer might be able to squeak by as one.

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

#142

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. Ironically, the PEP to add this to py3k is what's causing all the fuss in pythonland lately.

Actually I think it was 'fixed' as a syntax change in Python 3, https://docs.python.org/3/whatsnew/3.0.html#changed-syntax "List comprehensions no longer support the syntactic form..."

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

#143

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

Whenever I see that clip what I’m left wondering is if there really are people that press the space bar eight times. I have no recent memory of any editor didn’t let me press the tab key and have spaces appear instead.

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

#144

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.

Yep, a truly Jack of All Trades, Master of None. And this is fine.

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

#145

Earlier quoted context omitted.

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…

agreed with all the posts above, the only real letdown for me was always the difficulty to produce standalone executables. I would really love a python equivalent to uberjars or go's build tool.

[deleted]

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

#146
post #124

Earlier quoted context omitted.

Office Macros (and the underlying Windows COM interfaces), which include all of those features if you enable it. Bash. Desktops versions of browsers have all those things you listed. Mobile browsers do not. Also only modern-ish desktop browsers have that feature set, for a very long time the predominant browser of the day hardly had any debugging experience worth mentioning, the two I've listed have had them for a lo…

> Office Macros (and the underlying Windows COM interfaces), which include all of those features if you enable it. Bash. Bash is a good one! But I think windows ships without it. Office Macros are a really good one. Excel is also really good. But I think Windows technically ships without both, whereas the current browser is technically a full on programming environment and has been there since (minimally) IE7, which…

Also, to be fair, I ommited that Windows ships with JScript automation, which I believe has some esoteric debugger and GUI you can access by default.

And yeah... It's JavaScript! Kind of.

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

#147
post #85

Earlier quoted context omitted.

> There seems to be a sentiment that Python is a kids language I only hear this from developers that have never used Python or work in problem domains where the language is genuinely not better (e.g. low-latency distributed services, embedded devices/IoT sensors). I've scaled Python & PHP web apps to a hundred million monthly visitors on Top 20 US destinations on very limited hardware (6-10 machines). It's surprising…

Even IoT sensors are easier to program with micropython. What I find worrying is the the language is changing to suit those people, e.g. type hints, rather than teaching them learning to use the language. You don't complain you can't use a hammer as a screw driver, you just don't use a hammer.

I agree that sensors are easier with Micropython and will use that if I can (unfortunately the C++/Arduino ecosystem is much, much larger). However, type hints are a fantastic feature and I can't recommend them enough to anyone who writes software for a living. It makes maintenance at least an order of magnitude easier.

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

#148
post #117
post #86

Earlier quoted context omitted.

Why would you want to actually enforce privacy? That makes it harder for the user to patch. Better to provide a mild discouragement via "_name".

That's an eternal ideological debate where there is always a rebuttal on the form "a-ha - but you could just...", but the rationale is this: Your class will probably be doing things with the private variables that aren't obvious, and will break things if you access them from outside. (Either by them having a different value than you expect, or expecting a different value than you set). Of course, if you have a perfec…

I don't understand the argument, though. Python's underscore variables are meant to not be accessed from outside. The argument against them isn't that you might be doing some non-obvious things inside the class, that's the whole point of them!

It's a way for the class user to say "I know this is terrible, I know this might break, I want to do it anyway".

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

#149
post #130

For some reason, I never liked Python. I don't know... its classes look weird with all those self, __init__, etc. The __init__.py for packages is also a strange choice to me. It has classes, but no interfaces. The language is even slower than PHP. Does Python have type hinting? What all the hype is about? I just don't get it.

Agree. I can't understand people praising the lightness and readability while at the same time stuffing their code with underscores. Also it seems often inconsistent. Like some functions are used as prefix (len(x)) while other are suffix (x.clear()), I assume for historical reasons. Or like the "b if a else c" which reverse the logical order (you evaluate the condition then you can tell if you go one way or another).…

Those are all valid gripes, but for most use-cases (where performance isn't critical), I haven't found anything better than Python yet. Ruby is an aesthetically nicer language and doesn't have those issues you mentioned in the first paragraph, but the Python ecosystem is amazing and better than Ruby's IMO. And compared to most other languages Python still feels very clean, terse, and pretty to me.

>multi-threading

Most interpreted languages have a GIL, sadly. But yes, this is annoying.

>dependencies management

Annoying, but resolved in part with new projects like pipenv, and also still a big issue for other popular languages.

>deployment

Also helped by pipenv, and Facebook's xar (https://github.com/facebookincubator/xar) is new but looks promising.

>no refactoring/static checking

It's a dynamic language. But this is now possible to some extent with type hints.

>python 2 vs 3

They did screw this up, yeah. Python 3 fixes a ton of issues and is a better language, but the backwards incompatibility created way too many problems.

>50 different kinds of strings

There are 2 kinds: bytes and unicode.

>APIs full of abbreviations which probably meant something to their creators 20 years ago

Can you give some examples? This is an issue in a few of the old standard libraries, but even then it's not too common. This is way, way more prevalent in PHP and C than in Python.

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

#150
post #18
post #6

Earlier quoted context omitted.

Can you explain implicit type conversions problems in python?

Implicit string and unicode conversions were confusing in Python 2. True + True evaluates to 2, although that is technically not a type conversion.

True + True is still 2 in Python 3.
Post reply on HN