Live data from Hacker News

Python has brought computer programming to a vast new audience

economist.com

261–268 of 268 posts

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

#261
post #183
post #178

Earlier quoted context omitted.

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

"My hope is that python will serve as a "gateway drug" to other languages like ruby, ML, C/C++, SQL" Your inclusion of SQL in that list really shows you have no idea what you're talking about.

SQL certainly is a programming language. It is a member of the declarative family of languages (eg. like Regular Expressions, or Prolog), rather than an imperative/procedural one.

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

#262
post #239

Earlier quoted context omitted.

Yea, so is HTML, but if someones list of useful programming languages went C#, HTML, ruby, SQL. You would have to admit too that you would consider that person very inexperianced. It’t like listing a blender in a list of your favorite power tools. It’s not that it’s not useful for what it does, it just doesn’t belong in that particular comparison.

SQL stands for standardized query language.

It was originally SEQUEL (Structured English Query Language) and then changed to SQL (Structured Query Language) due to acronym conflict with Hawker Siddeley's trademark.

https://en.wikipedia.org/wiki/SQL#History

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

#263

Earlier quoted context omitted.

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

So, I really like How To Design Programs, because the thing it got across for me is how to appropriately think in a functional way. It walks you through building data structures and full programs in a really nice method. I've now been going through SICP, and nothing has seemed out of place as the notation is almost identical, and the few places that it isn't are not hard to translate.

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

#264

Earlier quoted context omitted.

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

So, I really like How To Design Programs, because the thing it got across for me is how to appropriately think in a functional way. It walks you through building data structures and full programs in a really nice method. I've now been going through SICP, and nothing has seemed out of place as the notation is almost identical, and the few places that it isn't are not hard to translate.

My question was more about which program language, which Lisp to choose in 2018?

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

#265
post #66

For me it's somewhat strange that it is universally presented as a beginner's language. Python would be hugely confusing to me if I didn't keep the underlying C model -- dynamically allocated objects with reference counts -- in mind at all time. Together with a lot of protocol that is largely arbitrary.

When teaching Python to beginners, I struggle with the concept of mutability -- e.g. `sorted(mylist) vs mylist.sort()` without being able to refer to the concepts of memory and references. But it's not a terrible obstacle if you drill in extra adherence to logic and testing and jumping into REPL. After enough trial-and-error with `x is y` `x == y` and `id(x)`, the abstract concept comes through without having to ackn…

Hardly a beginner at programming, but I also struggled with this when I picked up Python recently. The documentation doesn't make it obvious when functions have this sort of side effect, so like your students I play with the REPL to establish exactly what a function will do. Even then an unexpected side effect was the source of the single most perplexing bug in my program. I imagine that in complex programs this philosophy of sometimes-mutability-sometimes-not must lie at the root of a huge amount of programming error.

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

#266
post #254

Earlier quoted context omitted.

That code is invalid, because you're using "int(x)" as an assignment target. What would you expect it to do?

sorry: sum(int(x) > 3 for x in iterable)

That works better if you expect things in iterable that aren't ints, but it's still summing bools. int(x) > 3 returns a bool, so in the end it's still doing something similar to

  sum([True, False, False, True, True, False])
But if bools didn't implicitly behaves like ints, but could still be converted to ints, you could do this:

  sum(int(x > 3) for x in iterable)

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

#267

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…

CORRECTION: My regret was referring to a problem where this code worked in Python 2 but not Python 3:

    x = 100
    y = [x+i for i in range(2)]
In Python 3 I kept seeing

    NameError: name 'x' is not defined
However, after working around this problem with fixes like this -

    x = 100
    y = (lambda x=x: [x+i for i in range(2)])()
    
I have just discovered that the different scope treatment was due to a problem with IPython when using it in embed mode, for example by calling it with the following command:

    $ python -c "import IPython;IPython.embed()"
It goes away when you call ipython directly

    $ ipython

I mistakenly attributed this problem to Python 3 for years, I guess I introduced the problem because I had a different way of invoking Python 2 and Python 3 - yeesh.

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

#268

Earlier quoted context omitted.

So, I really like How To Design Programs, because the thing it got across for me is how to appropriately think in a functional way. It walks you through building data structures and full programs in a really nice method. I've now been going through SICP, and nothing has seemed out of place as the notation is almost identical, and the few places that it isn't are not hard to translate.

My question was more about which program language, which Lisp to choose in 2018?

Oh, so How To Design Programs uses "teaching" languages, which are sub-languages of Racket. Going from that book to learning the full features of Racket has been fun.
Post reply on HN