Live data from Hacker News

Python has brought computer programming to a vast new audience

economist.com

241–250 of 268 posts

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

#241
post #96

Earlier quoted context omitted.

I believe SQL is "the most deployed programming environment family in human history". SQLite is seemingly everywhere. Your second paragraph does not follow from the first. It could instead be that HN commenters are poor at this sort of analysis, or that people in general are poor at this sort of analysis. What were the contemporaries with similar design constraints? I started looking at Python in 1995, and the major…

> 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?

Most of those web browsers embed SQLite:

https://www.quora.com/Which-browsers-support-SQLite-How-univ...

Which I think is available interactively through Javascript? (To lazy to research further right now.)

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

#242

Earlier quoted context omitted.

Many languages are not strongly typed (where "strongly typed" means "variables must be predeclared with their types (though they may be inferred)"). If your only experience is with strongly-typed languages, then MANY things about Python will be different, because Python is one of many languages that is not strongly typed. For example, in Scheme (a Lisp), a division (/) presented with exact input values and a non-zero…

Double check me on this, but I'm pretty sure your definition of strong types is wrong; that's static typing. Python is strongly typed but not staticly. Weak typing is more like 1 == "1" is true. Aka implicit parsing or casting.

Weak vs strong typing doesn't have a standard mathematical definition but you are correct that it is usually has to do with implicit type conversions.

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

#243
post #57

Earlier quoted context omitted.

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

Many languages are not strongly typed (where "strongly typed" means "variables must be predeclared with their types (though they may be inferred)"). If your only experience is with strongly-typed languages, then MANY things about Python will be different, because Python is one of many languages that is not strongly typed. For example, in Scheme (a Lisp), a division (/) presented with exact input values and a non-zero…

[deleted]

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

#244
post #207
post #205

Earlier quoted context omitted.

If the competition is R, I can see how python is a pretty language. I think R still has prettier charts, with ggplot. However, there can be little argument that it is a peculiar language. That said, I don't see much that python really has going for it in the pretty scenario, either. Most of the examples that make it worth looking at get ugly as quickly as most any other programming language. And the error messages ar…

Not as any other language, but as any recently designed language. They (almost) all have good REPLs and a decent variety of data structures. It's easy to compare Python against C or Java and say how great it is, but against Rust or Dart, maybe not so great. However, popularity has its own benefits. Still, compare against Go. There's a major difference in philosophy of deployment. Python's modularity causes dev ops pr…

Fair, I meant as any comparable language. Though, I confess I suspect people could make more progress with C and the like than the advocates of python would like to acknowledge.

And I'm quite fond of lisp nowadays.

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

#245

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.

This was circulating around HN a few days ago: https://github.com/facebookincubator/xar

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

#246
post #242

Earlier quoted context omitted.

Double check me on this, but I'm pretty sure your definition of strong types is wrong; that's static typing. Python is strongly typed but not staticly. Weak typing is more like 1 == "1" is true. Aka implicit parsing or casting.

Weak vs strong typing doesn't have a standard mathematical definition but you are correct that it is usually has to do with implicit type conversions.

Decades ago, the Pascal camp hijacked the term for the requirement of explicit conversions in a static language.

Pascal would be strongly typed because for instance, characters and integers will not inter-operate without chr and ord, and also floating and integer conversions must be explicit. This is in contrast with something weakly typed like C. The weakness in C can be a problem. For instance, a floating to integer conversion that is out of range of the target type invokes undefined behavior. Also, when in range, it can produce a value not equal to the original integer, due to lack of precision. So an innocuous statement like f = i; that passes static type checks without any required diagnostics can go wrong. If a cast were required to make the diagnostic go away, then that at least creates a visible record in the program text that a dangerous conversion is taking place.

Another use of "strongly typed" in the realm of Pascal is that it refers to name equivalence for type alias definitions. The C typedef mechanism is weakly typed because "typedef int user_id_t" doens't create a new type; user_id_t is the same thing as int, such that a pointer to user_id_t is compatible with pointer to int and so on.

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

#247

Earlier quoted context omitted.

> "Python fits your brain" For me, I find using python is like touching both data and code with my hands. As much as it's trendy to bash Object Oriented languages, the way python allows to lookup all variables and method on a class or an object makes it like using your hands: dir(MyClass) help(MyClass) dir(my_object) help(my_object) etc...

If you'd like to go further along that path, and I'd really recommend trying to learn a lisp. How to Design Programs[0] is good gentle introduction if you're new to the ideas of lisp or functional programming, and SICP[1][2] is the old classic. [0] http://www.ccs.neu.edu/home/matthias/HtDP2e/index.html [1] http://web.mit.edu/alexmv/6.037/sicp.pdf [2] https://www.youtube.com/watch?v=2Op3QLzMgSY&list=PLE18841CAB...

Which one though?

I have looked at LISPs, but it's difficult to pick one to invest time in. Because I am so restricted on time I have to stick to languages which are used in the industry (so my fun has real-life ROI), which I think boils down to CL which is often touted as old-fashion and its market seems to shrink slowly, and Clojure which means the JVM and mainly Java libraries and high mem requirements.

For pure fun and practicality, Racket does seem up on the "list", but not used at all in the industry. A lot of languages (Python, Rust) are adopting the good parts of lisp (except for the minimal syntax, sadly), and I'm getting better mileage from spending time learning and becoming better at those than starting from scratch in a language that I won't be able to use during work hours.

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

#248

Earlier quoted context omitted.

> Sometimes you do want to do math on bools.. Can you provide a concrete example for when this would be useful? I assume you're not talking about binary arithmetic.

Here are some examples from the Python standard library: multiprocessing/pool.py: self._number_left = length//chunksize + bool(length % chunksize) test/test_math.py: tmant = tmant // (2*h) + bool(tmant & h and tmant & 3*h-1) From NumPy and SciPy: numpy-1.11.0/tools/swig/test/testArray.py:385: sys.exit(bool(result.errors + result.failures)) scipy/scipy/signal/signaltools.py:2003: n_out = n_out // down + bool(n_out % d…

Looks like the libraries use the technique to handle those conditional off-by-one situations that other languages might resolve with a ternary expression. Thanks!

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

#249
post #203
post #22

There seems to be a sentiment that Python is a kids language - but I think of Python as a language that scales with your experience. You can do some really interesting and complex things and I’m really appreciative of my deep understanding of the language through a decade of heavy use, open source contribution, and project ownership. Recently I released a package which allows you to dynamically create or change funct…

>>There seems to be a sentiment that Python is a kids language Python is like the new Basic. Very easy to work with, so a lot of people would be using it. Like volumes of people.

Python also gets used for some serious stuff in a way that Basic never did. CERN use it to control their systems, 'Try Ubuntu' to install a second operating system, Youtube to play videos and so on.

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

#250
post #225

Earlier quoted context omitted.

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

> There are 2 kinds: bytes and unicode. No I mean single quote, double quote, triple double quotes, r prefix, u prefix, f prefix, combinations, etc > Can you give some examples The one I have in mind is the os library, which I use a lot (like why st_mtime?).

>No I mean single quote, double quote, triple double quotes, r prefix, u prefix, f prefix, combinations, etc

These are all extremely helpful, though. All of those quote combinations are equivalent, and can be used to prevent having to escape quotes within the string. The u prefix is gone from Python 3, r is a raw string (which many other languages have, like C#'s @ prefix), and f is a new feature which generated a lot of debate but basically allows interpolation similar to Ruby and ES6.

>The one I have in mind is the os library, which I use a lot (like why st_mtime?).

That's the one I thought you were going to bring up. I agree the naming conventions in the os module have a lot of warts. The function names could use a refresh.

Post reply on HN