Live data from Hacker News

Why People Should Learn Python

iluxonchik.github.io

91–100 of 329 posts

Re: Why People Should Learn Python

#91
post #64

Why you shouldn't learn Python: 1. In-consistant syntax. 2. The language uses exceptions to control flow of logic. 3. Divided community, since Python 3+ included breaking changes to the standard. 4. Un-discoverable APIs. You better hope the documentation is bulletproof else the API could change in any which way during runtime. 5. Poor error messages. If an import goes wrong you are not told why, and so on. 6. Ultimat…

> 4. Un-discoverable APIs... One of the main reasons I like python is that it is the most self-documenting language I've come across. Say what you like about significant whitespace, but in my last job I used to show salespeople snippets of code and they understood them - with no knowledge of the language.

I agree that the code does document itself well. The biggest problem I have is the docstrings [1] which I find quite weird and find the Javadoc style comments much more readable.

  [1]: https://www.python.org/dev/peps/pep-0257/

Re: Why People Should Learn Python

#92
post #36

Why you shouldn't learn Python: 1. In-consistant syntax. 2. The language uses exceptions to control flow of logic. 3. Divided community, since Python 3+ included breaking changes to the standard. 4. Un-discoverable APIs. You better hope the documentation is bulletproof else the API could change in any which way during runtime. 5. Poor error messages. If an import goes wrong you are not told why, and so on. 6. Ultimat…

1. a matter of tast 2. care to elaborate ? 3. it's not divided, it's evolving from 2 to 3. Java's community is under Oracle's grip, don't know if it's any better... 4. it's not because you can do it that it's worth to do it, so in practice API are just not changing at runtime 5. I can say the same of my industrial strength Java environment... 6. Not a problem since what you do doesn't require speed 7. Ever used PyCha…

#2 is because it is more "pythonic" to ask for forgiveness than permission (EAFP).

For example, rather than checking if a dictionary has an element before accessing it, you just try to access it and handle the KeyError if it doesn't. The code reads easier and the normal flow would be faster in this case.

When used in EAFP context only, I think it is fine to use exceptions as part of logic in Python. They are relatively less costly compared to C.

Re: Why People Should Learn Python

#93
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 wish Ruby had the math and scientific library support of Python. Also, I've been using Jupyter lately to brush up on data structures and algorithms. It's been pretty sweet to write code in a web notebook and render output including digraphs beneath each block of code. Is there anything like that for Ruby?

You can use other kernels in jupyter notebooks. I've never tried ruby, but you could try this: https://github.com/SciRuby/iruby

Re: Why People Should Learn Python

#95
post #88

Earlier quoted context omitted.

"Making it hard to copy-paste code from the web" is something that I would consider a feature, to be honest.

Some similar failure cases are: 1) when I make a presentation using Keynote, it drops the leading spaces when it exports to PDF, so my students can't simply copy/paste my example code. 2) the interpretation of blank lines with no indentation on the repl means "end of current code", which is different than in a .py file. This means if I copy&paste from my in-development code to the repl, I can get syntax error unless…

For (2), ipython and %cpaste are your friends.

Re: Why People Should Learn Python

#96
post #38

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…

What I find interesting is that we are so quick to follow new trends.

Isn't there a psychological aspect to this - that if you are on the cutting edge of languages/frameworks, that you believe you will have an edge over everyone else and a chance to be better for a period of time at least? This is of course typically ignores whether the cutting edge can actually solve problems better than mature languages/frameworks.

Re: Why People Should Learn Python

#97

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…

Maybe all your C#/.NET/Java devs can't access HN because their big enterprise businesses have security policies which have blacklisted it? Hah.

.NET/Java is to pay the bills, and we vote for the fun stuff while we create our boiler plate classes.

Re: Why People Should Learn Python

#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 package management to Anaconda. Also, I haven't had to deploy any production public-facing apps in Python.

I don't share your experience on the documentation of libraries though. I've generally had no problems working with the major third-party libraries (requests, python-dateutils, Flask).

And I also am reluctant to feel strongly against how the 2v3 chasm has been drawn out, though it's easy to say that as someone who didn't have to make the jump. The main difference from Ruby 1.8->1.9, AFAICT, is that the Ruby community has a near-monolithic devotion to Rails. When Rails left 1.8 behind, not making the jump would basically be career-suicide for a Ruby dev. The downside is that it shows how dependent Ruby is on Rails' momentum. Whereas in Python, a scientist (among several other use-cases) can live on 2.x for a very long time no matter what all moves to 3.x.

Re: Why People Should Learn Python

#99
post #74

Earlier quoted context omitted.

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…

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.

Re: Why People Should Learn Python

#100
post #38

Earlier quoted context omitted.

What I find interesting is that we are so quick to follow new trends.

Isn't there a psychological aspect to this - that if you are on the cutting edge of languages/frameworks, that you believe you will have an edge over everyone else and a chance to be better for a period of time at least? This is of course typically ignores whether the cutting edge can actually solve problems better than mature languages/frameworks.

Psychology is a very broad area. We all want to be part of something, a community or culture, especially one witch is highly regarded among our peers.
Post reply on HN