Live data from Hacker News

I don't like Python. Does that make me a bad person?

news.ycombinator.com

211–220 of 231 posts

Re: I don't like Python. Does that make me a bad person?

#211
post #88
post #4

Yesterday there was an interesting link on HN comparing NLP in Python vs. other languages: http://nltk.googlecode.com/svn/trunk/doc/howto/nlp-python.ht... . I think this article shows the clearness of the Python language - - and this clearness and simplicity is the reason why I love to code in Python.

Don't know why, but I feel the need to contribute a shorter Ruby sample that feels closer to conventional Ruby. :) ARGF.lines.each { |line| line.split.each { |word| word.match(/ing$/) and puts word } }

Equally cryptic to perl syntax imo..

Re: I don't like Python. Does that make me a bad person?

#213
post #200

Earlier quoted context omitted.

> Ruby is incredibly flexible, whereas Python is not. Often times my idea of the way things should be done is not Guido's idea, and so Python seems a bit lacking. Apropos: Does Ruby optimize tail calls?

http://stackoverflow.com/questions/824562/does-ruby-perform-...

Thanks, I did some searching and found this, too, after I wrote my comment.

Re: I don't like Python. Does that make me a bad person?

#214
post #66

Earlier quoted context omitted.

You don't, because auto indent for python doesn't and can't exist.

You say this, and get points, but I'm not sure what you mean. I've written Python and gotten each new line to automatically indent to the proper point, with a functional backspace that unindents the appropriate amount. I've then copy-pasted blocks with several different indentation levels that were automatically adjusted to the surrounding code, with the possible exception of an error corrected by a single keypress.…

If you write code like this:

  if x:
      # do stuff
  # do other stuff
Your indenter will not know where to put the third line.

In languages whose blocks are closed using nonwhitespace the problem doesn't exist. Your indenter just has to push everything as far to the right as it can, and problem solved.

It's nice that your editor gets copy and paste right, but it doesn't and indeed can't decide how to indent your code, something that works in every other language I've dealt with.

Re: I don't like Python. Does that make me a bad person?

#215

Earlier quoted context omitted.

what makes you think you can't grep for the request object/class?

What I implied was that it was not immediately obvious what the class was. def foo (self, stream): What is stream here? void foo (std::ostream &out) { out Hope you get the point.

So, grep for what's calling your function, or use pdb.set_trace()

Re: I don't like Python. Does that make me a bad person?

#216

Earlier quoted context omitted.

Python's whitespace indentation seems like a great idea until you realize that it makes things like copying & pasting code from web pages etc far more difficult and, worse, makes automatically reindenting a block of code in an editor impossible. If I come across a badly formatted block of code in Ruby or Java or C in emacs it takes me one keypress to sort it out. In Python I have to carefully, manually look at each l…

> it makes things like copying & pasting code from web pages etc far more difficult This. I'm convinced half the reason Ruby is displacing Python is that it's actually practical to talk about Ruby code in forums without ridiculous little-known workarounds like pastebins.

I do think that it's a pretty major issue, although I also don't get the impression that Ruby is displacing Python. If anything it seems like the momentum from Rails is petering out a bit.

The Ruby community itself does strike me as more energetic though. All the activity on github etc seems a lot more impassioned to me than the coolheaded & practical world of Django et al.

Re: I don't like Python. Does that make me a bad person?

#218

I still write most of my code in C. Could never really warm to C++ and Java was fun in the early days, but the sheer volume of API's, J2EE, et al eventually crushed my spirit. It took me several goes to become friendly with Python. I find it excellent to try out algorithms. If I don't know how something is going to be best implemented, then writing a bunch of classes in Python and tweaking attributes and methods unti…

I didn't warm to Python until v2.2. Took an article by Eric Raymond for me to take another look at it and it finally clicked. Great for trying out ideas, etc. But I still write all the heavy duty stuff in C. Its really cool to do the heavy lifting in C and expose it as a shared library and then do the coordination stuff in Python.

Re: I don't like Python. Does that make me a bad person?

#219
post #195
post #189

Earlier quoted context omitted.

An easier Ruby solution would be: ("letters in this sentence" + "and this one").chars.sort.reverse

Except you aren't using sets, so you get duplicate characters. I can just as easily write ("letters in this sentence" + "and this one").toSeq.sorted.reverse in scala. You could tag the end of your ruby statement with .uniq and you would be fine. Alternatively, you could wrap the above scala statement in TreeSet(). These solutions process things in a significantly different way than was done by the OP, though.

("letters in this sentence".split(//) & "and this one".split(//)).sort.reverse.join

I'm just learning, but I think this performs it correctly with sets.

Re: I don't like Python. Does that make me a bad person?

#220
post #214

Earlier quoted context omitted.

You say this, and get points, but I'm not sure what you mean. I've written Python and gotten each new line to automatically indent to the proper point, with a functional backspace that unindents the appropriate amount. I've then copy-pasted blocks with several different indentation levels that were automatically adjusted to the surrounding code, with the possible exception of an error corrected by a single keypress.…

If you write code like this: if x: # do stuff # do other stuff Your indenter will not know where to put the third line. In languages whose blocks are closed using nonwhitespace the problem doesn't exist. Your indenter just has to push everything as far to the right as it can, and problem solved. It's nice that your editor gets copy and paste right, but it doesn't and indeed can't decide how to indent your code, somet…

Why does that matter?

In brace language:

if (condition) {{ code_1 }} code_2

In Python:

if (condition):\n code_1 \n^H code_2

Unless your editor also knows when to place your close braces, and, haha, it doesn't and indeed can't, you have not even won a keystroke.

Post reply on HN