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__??
Why People Should Learn Python
191–200 of 329 posts
Re: Why People Should Learn Python
#192Earlier 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(:+)
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
#193Earlier 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.
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
#194Earlier 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.
Re: Why People Should Learn Python
#195Is 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…
Re: Why People Should Learn Python
#196Earlier 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.
* 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
#197Earlier 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…
Re: Why People Should Learn Python
#198It 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
#199Is 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…
***** 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, CoffeescriptRe: Why People Should Learn Python
#200Earlier 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.