Live data from Hacker News

Why People Should Learn Python

iluxonchik.github.io

81–90 of 329 posts

Re: Why People Should Learn Python

#81
post #57
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…

Check out conda sometime.

That looks interesting, I've also tried out pip-tools[0] which is really nice. However nice these tools are it seems to a bit at odds with the Zen of Python. Ideally there should be just one single good way to deal with packages. Ironically this is the case for Ruby, but not at all for Python. Ultimately you can always use some alternative method that solves it better, but you then have to take on the burden of convincing your co-contributors that it is a better idea than using pip and you also have to explain it to anyone that joins your project.

0: https://github.com/nvie/pip-tools

Re: Why People Should Learn Python

#82
post #73

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…

I would say that node.js is very liked on HN. Half the stories here are about Node.js. But I rarely see any positive mentioning on HN about c#, .NET, C++ or Java.

> Half the stories here are about Node.js.

I think that might be a slight exaggeration. At present, zero of the stories on the HN front page appear to be about Node.js.

Re: Why People Should Learn Python

#83
post #14
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__??

I believe it's part of the language design, a phrase you'll find quite a lot in Python language discussions, especially is more esoteric features is; "We're all consenting adults". There are certain areas of the language which may not behave exactly the way you'd be expecting, if you're new to it. These usually have an unusual syntax, which will cause you to find out more. They're basically the mini-roundabouts of py…

Unless of course you're in Belgium where all junctions are by default preference from the right (so like a mini-roundabout but with no markings), which are opposite preference from roundabouts here which are preference from the left. But some junctions are labelled, some aren't depending on whether the local council could be bothered, some people will forcefully use their preference and risk a crash but 90% will ignore it.

Driving in Belgium - the scripting equivalent of batch files

Re: Why People Should Learn Python

#84
post #28

Earlier quoted context omitted.

Name a single language that covers all those things and has a pretty syntax.

01000010 01101001 01101110 01100001 01110010 01111001 00111111 00001101 00001010?

10010 10202 11020 11002 10121 11020 11111 01020 00101

Re: Why People Should Learn Python

#85
My initial progression of languages was: QBasic, Visual Basic, C++, Java (1.5), Python. Python was leaps and bounds more fun and productive than flailing away with any of those.

But today, I'm less excited about it. I've gotten spoiled by C#, that has static typing, and consequently, better tooling, as well as a good measure of the flexibility of Python, through dynamics, lambdas, LINQ.

It seems Python is finally getting over the 2.X -> 3.X schism, but that kind of threw a wrench into things for a number of years, as well.

Re: Why People Should Learn Python

#86
post #16

The person who wrote this obviously has "the hacker's mindset". He praises expressivity and malleability of the language. Well, in this case it might be advisable to take a look at Perl. And never go back. Perl (especially Perl6) is hacker's paradise, where everything's true and nothing is forbidden. As somebody who shares the same mindset, I truly enjoyed my years with Perl, and I occasionally return to this experie…

> is hacker's paradise And support engineer's hell

So is Python. I've worked on code bases in several languages, and the greatest horrors I've seen are in Python and C++, in that order.

Python is a strange case. The CPython code base seems to be quite well organized and well written, and about 10% of packages on GitHub or PyPI are extremely solid.

The problem is the staggering amount of packages (public or in-house) that have 100000+ LOC and use the worst features of OO, functional, and procedural programming at the same time.

The result is not spaghetti code, but ravioli code where there's zero control flow and "everything happens somewhere else". Add to that the "consenting adult" philosophy, and you have the modern equivalent of goto mixed with self-modifying code.

I'm sure Perl has all that, but it's far from the only language.

Re: Why People Should Learn Python

#87
I was a long time Rubyist but switched over to Python because even though its characteristics and philosophy made me reflexively shirk it at first -- particularly significant whitespace, one-line-lambdas, and the clusterfuck of 2.x vs 3.x -- it seemed to me to be an obviously easier language to teach, nevermind its significantly stronger libraries for numerical work.

I'm glad I made that decision. The language was easy enough to pick up in my spare time. I hardly ever use pandas/numpy unless I'm doing some really serious statistical work; the core language and patterns in Python are now pleasant enough for me to use in day-to-day data wrangling and hacking. I'm now mixing in Ruby for a current project -- mostly because I like Rakefiles, and also, Ruby's static site generators like Middleman -- and it's been surprisingly painful to do things in Ruby. I used to hate how when doing a Google search for something in the Python stdlib would bring up 2.x before 3.x...but it almost seems even more problematic in Ruby, where 1.9.3 and 2.0.0 docs keep coming up, even though official maintenance of them has been dropped.

(2.0's maintenance ended in Feb. 2016 http://ruby-doc.org/core-2.0.0/Array.html)

If I didn't know better, I wouldn't even know what Ruby's official version was. For me, Google results show no other documentation for Ruby's Array, as the next results are from tutorialspoint and sitepoint.

And that's not even getting into the issue of how problematic the do-things-how-you-like freedom of Ruby is incredibly hard to discern as an outsider. To give one example I recently had: how do you iterate through a human-calendar-based time interval, such as a month (i.e. any interval that doesn't have a constant length in seconds)?

In Python, I remember how frustrating it was to figure out what the hell the difference was between datetime, time, calendar, the gmtime function, and then timedelta, and then the third-party libraries of pytz and python-dateutil. But once I understood them, which was largely a matter of realizing how naive I was about the nature of measuring time, doing something like iterating over calendar intervals is straightforward.

This is my first Google result for "python iterate month intervals" -- it's from 2008 and still works perfectly: http://stackoverflow.com/questions/153584/how-to-iterate-ove...

Now here's the result for Ruby; all of the answers, as far as I can tell, are not only not-very-Rubyish, but not reliable either: http://stackoverflow.com/questions/1724639/iterate-every-mon...

FWIW, I remember solving this problem by using the DateTimein ActiveSupport. Which is a credit to how much fun and joy it is to build things in Rails right out of the box. But that complexity catches up quick, and including ActiveSupport in day-to-day Ruby work can sometimes to unwanted monkeypatching.

Re: Why People Should Learn Python

#88
post #34

Earlier quoted context omitted.

8. Significant whitespace. Not only is it a constant minor inconvenience when editing the program, it makes it very hard to cut-and-paste code fragments on the web.

"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 I carefully ensure that all blank lines inside of indented code blocks are also indented.

Re: Why People Should Learn Python

#89
post #3

Why is a beginner's introduction to one of the common scripting languages at the top of HN? Most everyone here should know at least one of the usual suspects (Ruby, Perl, Python, etc). They are all quite similar in capabilities. Is introduction to loops at the top, in an hour? Edit: The few newbies here which don't know a scripting language are hardly the ones voting this up... Edit 2: BanzaiTokyo is free to explain…

Reading the opinions of others gratifies my own intellectual curiosity, and as I am one of HN's readers, it fullfills the definition.

PS: editing your own post to reply is a weird way to do things when there's a "reply" link under each comment...

Post reply on HN