Live data from Hacker News

Why People Should Learn Python

iluxonchik.github.io

191–200 of 329 posts

Re: Why People Should Learn Python

#191
post #2

Now that I have a chance to ask: I've always found the def __init__ method with 4 (!) underscores one of the ugliest things I've seen in a programming language. Don't get me wrong: I like Python and know it's truly good, but __why__??

Just import attrs [0] and don't worry about those annoying dunder methods.

[0] https://pypi.python.org/pypi/attrs/16.0.0

Re: Why People Should Learn Python

#192
post #146

Earlier quoted context omitted.

Could you give an example of that?

Imagine you have a list of products with prices and you want to calculate the cost of all products that are of a certain type. In ruby you can write this as products.select { |product| product.type == 'x' }.map(&:price).reduce(:+)

And in Python you can write something like:

    sum([p.price for p in products if p.type == "x"])
Excuse untested code from phone, but I like it better than the ruby version.

Re: Why People Should Learn Python

#193
post #99
post #74

Earlier quoted context omitted.

just to chime in on this, modern PHP is nothing like what people remember from the pre ROR days, i still use it to this day and the major frameworks and libs are really well written to the point i feel some are even over engineered and almost looking like Java (just take a look at the latest Guzzle PHP Library)

As my PHP fluent colleague said to me - don't bother learning PHP or you will end up having to fix (our) Wordpress sites and thats a nightmare. We have a Python application, and while its not written well, the PHP sites we have seem to be a fair bit worse even the ones not done in Wordpress.

> As my PHP fluent colleague said to me - don't bother learning PHP or you will end up having to fix (our) Wordpress sites and thats a nightmare.

This is my life right now... lol

It's not so bad, but the frustrating part is when I talk to people in interviews about all of the great work I'm doing modernizing (the surrounding) WordPress infrastructure and the tools I've built for it, their eyes just glaze over.

I frequently get told "you're a talented developer and you're wasting your time working at X". Well, at least at my job I get to remove technical debt constantly. I don't feel like that's the case at these places I'm interviewing.

Re: Why People Should Learn Python

#194
post #74

Earlier quoted context omitted.

just to chime in on this, modern PHP is nothing like what people remember from the pre ROR days, i still use it to this day and the major frameworks and libs are really well written to the point i feel some are even over engineered and almost looking like Java (just take a look at the latest Guzzle PHP Library)

My understanding is that the majority of PHP jobs out there are maintaining old, outdated, and bad codebases using an old version of PHP so a lot of people just don't bother.

There is probably some truth to this. Every single contract I have been offered in the past 2 years including the one I am currently working required PHP5.6 & 7 knowledge, git, composer, JS, the latest JS frameworks, etc. Start the job... PHP5.3 codebase w/ some old jQuery. Its an absolute nightmare. I have to go home at night and write in PHP7 just to maintain some level of sanity or I'd have to cry myself to sleep. The only thing that makes the job tolerable is that I was able to load xdebug on the dev environments (though it doesn't always work b/c of all the redirects - it still is good enough to get me 90% of the way there).

Re: Why People Should Learn Python

#195

Is it just my feeling or are there languages which are preferred on HN? Indicators for languages which are liked by the HN community: - Positive stories get many upvotes and are instantly at the top of HN - Most comments are positive - Frequent coverage on HN about the language Indicators for languages which are not liked by the HN community: - Rants get many upvotes and are instantly at the top of HN - Most comments…

Node.js isn't a language.

Re: Why People Should Learn Python

#196

Earlier quoted context omitted.

I'm often frustrated with python packaging but after trying a few other languages' equivalents' (npm, go, etc.) I'm starting to think it's really not so bad.

I'm curious as to what issue you're running into with npm? npm install pug --save , installs to your local project, and adds to package.json. Not sure how that can get any easier! Makes deployments silly simple as well, and the ecosystem is massive surrounding it.

* I sometimes had to run "npm i" twice in order to get it to work.

* It would often fail randomly.

* node_modules has a fixed location.

* There is a ludicrous number of dependencies even for the simplest projects. ~1000 is not unusual. Reasoning about that dependency tree simply isn't possible.

* There was even a package to detect if a number was negative. It had a version 2 because there was a bug!

* In general even small projects took an age to build.

I'm sure this isn't all the craziness, it's just the stuff I ran into during my (fairly limited) exposure to npm packaging.

Re: Why People Should Learn Python

#197

Earlier quoted context omitted.

Rust should then get 6 stars judging from unparalleled excitement every news about it brings here. Rightfully so in my opinion. By the way, it's "Clojure", not "Closure" and what happened to Scala?

I have actually wondered that myself (Scala). I was so excited about Scala years ago (2006). One of my TAs from college was working on the language as well. It finally looked like an OCaml for the masses. Over time my excitement changed. I assume others may share my thoughts hence the less excitement: * It is on the JVM and there are lots of languages on the JVM competing with Java. * While the fusion OOP + FP fusion…

I think Scala's still growing - I think OCaml is too. I'm worried that between Dotty and the focus on Java 8 support in 2.12, we've gone far too long without improvements to Scala syntax, or indeed a new release at all. Having written Scala professionally full-time for 4+ years I couldn't stand to go back to a language without higher-kinded types, which pretty much means I'm stuck on Scala or Haskell.

Re: Why People Should Learn Python

#198
Python is so easy to write, use and read, I would not understand how a programmer would not know it already.

It literally has everything you want in a language.

Granted, it's not on-the-metal fast, and it still has some gimmicks, like variables behaving like pointers or references (which can be a little awkward), but still, python is the language of the decade.

Re: Why People Should Learn Python

#199

Is it just my feeling or are there languages which are preferred on HN? Indicators for languages which are liked by the HN community: - Positive stories get many upvotes and are instantly at the top of HN - Most comments are positive - Frequent coverage on HN about the language Indicators for languages which are not liked by the HN community: - Rants get many upvotes and are instantly at the top of HN - Most comments…

Ordering languages and frameworks by amount of 'love' (edited with small adjustments):

  ***** Python, Rust, Lisp
  ****' Go, Swift, C, PostgreSQL
  ****  Elm, Elixir, Typescript, Haskell, OCaml, JS-ES6, Kotlin, Crystal
  ***'  Scala, Lua, Clojure, Erlang
  ***   C#/.NET, Java, C++, Ruby, JS-ES5, MySQL
  **    Node JS, RoR, Meteor, MongoDB
  *     PHP, VBasic, Cobol, Coffeescript

Re: Why People Should Learn Python

#200

Earlier quoted context omitted.

Imagine you have a list of products with prices and you want to calculate the cost of all products that are of a certain type. In ruby you can write this as products.select { |product| product.type == 'x' }.map(&:price).reduce(:+)

And in Python you can write something like: sum([p.price for p in products if p.type == "x"]) Excuse untested code from phone, but I like it better than the ruby version.

I guess it's a personal style choice, the Python code is more performant(less iterations over the data set), but I like the ruby version better.
Post reply on HN