Live data from Hacker News

Why People Should Learn Python

iluxonchik.github.io

151–160 of 329 posts

Re: Why People Should Learn Python

#151
post #98
post #43

I switched to writing python as my main backend/scripting language with my new job. Previously I was using Ruby for most of this stuff with some Go. I must say that so far Python has been a vastly inferior experience for me. The languages are fairly similar all though I prefer the more talkative/english style of ruby and the use of functions over list and dict comprehension. The thing that really stands out to me tho…

You bring up a good point. I'm in the same boat as you in terms of switching from Ruby to Python. Unlike you I've really enjoyed the switch. But also unlike you I've chosen to ignore (i.e. stick my head in the ground) the issues with the dev-tooling. Not that I ever had a strong understanding of how Rubygems worked, other than knowing why I needed to do `bundle exec rake [etc]`. But I've largely delegated the pain of…

python had the opposite problem where so many major libraries didn't take make the jump to Python 3, so even if you really wanted to use Python 3 it was extremely restricting to do so.

Re: Why People Should Learn Python

#152
post #51

Earlier quoted context omitted.

One obvious problem looking at your list is that PHP is ranked so low. This is likely due to the fact that most discussions on this site are not about PHP, but PHP frameworks like Laravel, Symfony, Zend, etc.

Not all - note the always relevant: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

That's not necessarily relevant. It's been rebutted point by point http://forums.devshed.com/php-development-5/php-fractal-bad-..., and PHP has undergone major changes since that was written.

Re: Why People Should Learn Python

#153

Earlier quoted context omitted.

> Having used Rubygems and bundler pip feels like taking an enormous step back. Personally I moved away from relying on language specific tools to do more than just "install library X" and manage my deployment and dependencies using docker. So far it works great for me. > There seems to be fewer nice libraries Depends on your domain. Ruby is very good at web development. Python is good at almost everything. > Python…

Did you take a look at pip-tools ? It allows dependency locking

What do you guys mean by dependency locking? What I do with pip is add a requirements.txt with things like:

Django~=1.10.0

And it keeps the env autoupdated with the latest patch revision but not the latest minor revision. pip-tools doesn't seem to do much related to that, no?

Re: Why People Should Learn Python

#154

Earlier quoted context omitted.

I find chained enumerator / block style code much easier to write and understand than list / dict comprehensions too. It's probably the single biggest thing that I don't like about Python; lambdas are simply too awkward, but lambdas + monadic transformations are probably my primary mental abstractions for writing software these days.

With itertools and functools you should be able to program in that style just fine. You'll likely want to give your lambdas names with a "def", but you should be doing that anyway.

As a fellow FPer who does the monadic stuff in other languages, I think it's usually more trouble than it's worth in Python. Instead, trying to use more of the python-specific language constructs can help you get what you want.

Python is pretty imperative, and the language design ethos is pretty against designing around functional programming. But if you try to absorb some of the python-specific stuff like list comprehensions, generators, and context managers, you can write some tooling to help you get a DSL a little closer to what you're used to.

Re: Why People Should Learn Python

#155
post #43

I switched to writing python as my main backend/scripting language with my new job. Previously I was using Ruby for most of this stuff with some Go. I must say that so far Python has been a vastly inferior experience for me. The languages are fairly similar all though I prefer the more talkative/english style of ruby and the use of functions over list and dict comprehension. The thing that really stands out to me tho…

I prefer Python over Ruby as a language, but you are correct

gem ist superior to pip. Take a look at "pip-tools" if you haven't already, it eases some of the pain.

For web-dev Rails is more stable, more modern and has better maintained library ecosystem than Django. Django is okay-ish but can't live up to Rails. Django still lacks some stuff that i feel it should bring with it out of the box.... dev/test/production setups, asset compilation etc.

On the other hand, if you don't need a full blown web framework and are looking for something more minimalistic, Flask is awesome.

Re: Why People Should Learn Python

#156

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…

At a glance, it looks like all languages are reasonably well loved except PHP and Node.js (shouldn't this just be Javascript? Does having a different standard lib make it a different language?) I think that's due to people having flash backs to terribly written code in both languages. For example, PHP apps pre-2005 rarely if ever used frontend controllers, preferring instead to twine in configuration and helper funct…

> Node.js (shouldn't this just be Javascript? Does having a different standard lib make it a different language?)

I think the dislike comes from the idea that JavaScript-development can be or at least was very messy and that "the JS-people" now try to carry that over to the server-side.

npm also has many issues and node as a server-side VM wasn't very dev-ops friendly in the beginning, if I'm not mistaken.

Note: This doesn't mean I don't like JS or node, I use them daily, though I have never used a production node-server. I'd rather run my JS on the JVM.

Re: Why People Should Learn Python

#157
post #139
post #134

Earlier quoted context omitted.

I've never understood this complaint. Whitespace is included when you copy something. What's the problem? Admittedly it is mildly annoying when someone decides to use some random number of spaces for indentation, and you have to fix it to make it match the rest of your code (my preferred editor, Geany, has a feature for this). We should all just use tabs. But "very hard"?

The web collapses whitespace so if the code is not in tags you are stuck. This is quite often a case where comment systems were not intended to share code.

You're right, of course, this does often happen. Seems to me, though, the issue isn't cutting and pasting something on the web - it's getting it losslessly onto the web in the first place. It's the responsibility of the person posting the snippet to ensure it shows up correctly, and if their chosen platform doesn't support that they should use a better one.

This probably reads pedantically, but I do think there's a distinction. By analogy, if someone tried to post APL on a site that didn't support Unicode, you wouldn't say the issue is it's "hard to cut and paste APL".

Re: Why People Should Learn Python

#158
post #139
post #134

Earlier quoted context omitted.

I've never understood this complaint. Whitespace is included when you copy something. What's the problem? Admittedly it is mildly annoying when someone decides to use some random number of spaces for indentation, and you have to fix it to make it match the rest of your code (my preferred editor, Geany, has a feature for this). We should all just use tabs. But "very hard"?

The web collapses whitespace so if the code is not in tags you are stuck. This is quite often a case where comment systems were not intended to share code.

[deleted]

Re: Why People Should Learn Python

#159

Earlier quoted context omitted.

Did you take a look at pip-tools ? It allows dependency locking

What do you guys mean by dependency locking? What I do with pip is add a requirements.txt with things like: Django~=1.10.0 And it keeps the env autoupdated with the latest patch revision but not the latest minor revision. pip-tools doesn't seem to do much related to that, no?

The problem with that is that you no longer have reproducible builds. If you checkout a year old commit and built deployment artifacts with it you want the resulting artifact the be the same as when it was created. This is what you get with Bundler and the Gemfile/Gemfile.lock split

You put

gem 'rails', '~> 4.2.7'

in your Gemfile and when you run `bundler install` the exact version of rails you ended up resolving with the above is locked in your Gemfile.lock. Thus if you have a version in Gemfile.lock it is the source of truth and you have reproducible builds. If you want to update rails given the pattern in your gemfile you just issue `bundle update rails` and it will update to the latest conforming version and update your Gemfile.lock

The fact that pip doesn't support this in a good way is a major limitation imo. You can have either reproducible builds or "auto upgrading", but not both. pip-tools solves this, but requires you to use a different tool than pip and by extension you have to teach and explain it to anyone working on your project.

Re: Why People Should Learn Python

#160
post #157
post #139

Earlier quoted context omitted.

The web collapses whitespace so if the code is not in tags you are stuck. This is quite often a case where comment systems were not intended to share code.

You're right, of course, this does often happen. Seems to me, though, the issue isn't cutting and pasting something on the web - it's getting it losslessly onto the web in the first place. It's the responsibility of the person posting the snippet to ensure it shows up correctly, and if their chosen platform doesn't support that they should use a better one. This probably reads pedantically, but I do think there's a d…

Yes I would. Requiring a character set outside of ASCII is what I'd call a high-risk design decision, that could easily become a misfeature of a language. Windows "smart quotes" are bad enough and that's not even a programming language. This is why people invented J as an alternative to APL.
Post reply on HN