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 } }
I don't like Python. Does that make me a bad person?
211–220 of 231 posts
Re: I don't like Python. Does that make me a bad person?
#212Re: I don't like Python. Does that make me a bad person?
#213Earlier 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-...
Re: I don't like Python. Does that make me a bad person?
#214Earlier 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 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?
#215Earlier 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.
Re: I don't like Python. Does that make me a bad person?
#216Earlier 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.
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?
#217Try Ruby. It gives much more freedom than Python, not to mention countless way of shooting oneself in a foot (which you know already from the C family ;)
Re: I don't like Python. Does that make me a bad person?
#218I 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…
Re: I don't like Python. Does that make me a bad person?
#219Earlier 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.
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?
#220Earlier 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…
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.