Live data from Hacker News

Python has brought computer programming to a vast new audience

economist.com

191–200 of 268 posts

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

#191

Earlier quoted context omitted.

I agree. I came to Python in 2000, after Perl (1996-1998), PHP (1999), Matlab (1992-1996), C++ (1990), Fortran (1989), C (1988), Pascal (1988), Assembly (1984-86) and Basic (1981-83). After all those, I found Python, as the saying goes, really does "fit your brain" [1]. Since discovering Python 18 years ago, I have looked at Haskell, successfully avoided Java, and promised myself to "one day" do more JS. Still, Pytho…

> "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...

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

#192
post #112

Earlier quoted context omitted.

No, I'm not referring to duck typing. An abstract base class enforces the interface. Explicitly. Some benchmarks might be slower, but I don't know anyone doing high-performance computing with PHP. I do see the topic at Python conferences.

abstract base class != interface

Let me help you two out:

ABCs are like interfaces in they can be used to enforce properties (like the presence of particular functions) of a class that extends/impliments them; BUT, interfaces can also be used to enforce a particular variable always refers to something with certain properties (without worrying about what it is concretely).

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

#193
post #153

Earlier quoted context omitted.

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.

The distinction between what an object is and what an object can do is an artifact of bad object modelling (specifically, single inheritance OOP.) Any “can do” set has an exactly corresponding “is a thing that can do” set, so there is no logical need for different constructs to model “is” sets and “can do” sets.

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

#194
post #155

Earlier quoted context omitted.

> The evidence is in the usage. That's not what I asked for. You're asking me to accept a concrete proposition that I obviously don't. To sway me, I'd like proof, not a single example labeled evidence.

Proof? Describe what proof means to you. The fact that Javascript decided not to adopt the syntax seems like good evidence to me. I'm not asking you to do anything. I'm offering you some insights. Normally people pay me for my time, but I suppose I feel like volunteering at the moment.

The fact that python decided to use a different syntax doesn't prove that it was good either.

What you volunteered to me is a mirror image of an argument you think I presented, then suggested my version was wrong.

But I'm not actually advocating for JavaScript syntax here. I just don't think list comprehension syntax, as presented by python, is particularly better in comparison. You said it's much better, then demanded that I agree with you.

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

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

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.

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

#196
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 is immensely successful.

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

#197

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.

Go one step further and add these to you vimrc:

    command Tab1 set ts=1 sts=1 sw=1
    command Tab2 set ts=2 sts=2 sw=2
    command Tab4 set ts=4 sts=4 sw=4
    command Tab8 set ts=8 sts=8 sw=8

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

#198

Earlier quoted context omitted.

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

:help 'sts

Number of spaces that a counts for while performing editing operations, like inserting a or using . It "feels" like s are being inserted, while in fact a mix of spaces and s is used. This is useful to keep the 'ts' setting at its standard value of 8, while being able to edit like it is set to 'sts'. However, commands like "x" still work on the actual characters.

When 'sts' is zero, this feature is off.

You can also abbreviate expandtab to et.

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

#199

Earlier quoted context omitted.

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.

The distinction between what an object is and what an object can do is an artifact of bad object modelling (specifically, single inheritance OOP.) Any “can do” set has an exactly corresponding “is a thing that can do” set, so there is no logical need for different constructs to model “is” sets and “can do” sets.

Sounds like a controversial statement and I'm not sure how universal true this is. I'll give it a thought. Thank you.

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

#200

Earlier quoted context omitted.

> 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. Unsurprisingly, I disagree with this opinion. Python code is typically nearly as much as a slog as Go code, but adopts all the brutally hard parts of the common lisp's functional world by only exposing wrap-p…

> And when change finally does happen, it happens in the way most likely to cause everyone heartache, as if to fulfill the prophecy the community made. I assume you're referring to the 2 to 3 split? Which happened once and every other change has left code in an completely runnable state. Unless you're talking about the C-API then, yeah, it's a PITA to keep it current across versions. Just today I learned about f-stri…

I was referring to that specifically and it's awful.
Post reply on HN