TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ruby or Python? Well, it depends...

43 pointsby hanszeirabout 14 years ago

7 comments

lloekiabout 14 years ago
<i>"but python + any python IDE &#60; Java + IntelliJ IDEA(Eclipse/NetBeans)"</i> (and I suppose s/python/ruby/g and s/Java/C#/g too)<p>I don't quite agree with this statement as I find python and ruby development easy, perfectly usable and well performing in a generic code editor (vim, emacs, textmate) whereas doing Java or C# almost mandates a full-blown heavyweight IDE with smart code completion like IntelliSense to get anywhere near the same efficiency. I've tried a few IDEs for python and ruby, and they seemed almost more of a hindrance than a help, and definitely not a significant improvement.
评论 #2513217 未加载
lloekiabout 14 years ago
Python's REPL has autocompletion. It is just not enabled by default as it lives in its own module and python prefers to start in an absolutely clean state.<p><pre><code> &#62;&#62;&#62; import readline &#62;&#62;&#62; import rlcompleter &#62;&#62;&#62; readline.parse_and_bind('tab: complete') </code></pre> See this article for the details (and more, like history persistence and REPL startup file): <a href="http://valueerror.wordpress.com/2009/11/03/python-shell-history-autocompletion-and-rc-file/" rel="nofollow">http://valueerror.wordpress.com/2009/11/03/python-shell-hist...</a>
评论 #2513220 未加载
latchabout 14 years ago
Python and Lua were the first languages I used that had tuples as a native/core/whatever type. Absolutely love them. Changes how you program sorta thing. Mind blown that every language doesn't have them.<p>Despite this, I can't get into Python (having tried 3 or 4 times the last couple years). The Ruby ecosystem is simply more polished...gem, rvm, capistrano, rails, sinatra bundler, .... I really tried to fall in love with Python/Django, and it just isn't as good as Rails by a wide margin.<p>When languages are as close as Ruby and Python (or C# and Java), frameworks/ecosystem/community matters a ton more.
评论 #2513069 未加载
评论 #2513115 未加载
评论 #2513078 未加载
评论 #2513130 未加载
bajsejohannesabout 14 years ago
&#62; Ruby and Python do not have statements - only expressions.<p>Unfortunately this is not true for python. The reason his print-example doesn't show the returned value is that there isn't one. In ruby, puts actually returns Nil, and we can assign it:<p><pre><code> &#62;&#62; x=puts(0) 0 =&#62; nil </code></pre> Whereas in Python, we get a syntax error<p><pre><code> &#62;&#62;&#62; x=print(0) File "&#60;stdin&#62;", line 1 x=print(0) ^ SyntaxError: invalid syntax</code></pre>
评论 #2514089 未加载
评论 #2513333 未加载
edanmabout 14 years ago
"If you’re looking for a flame post - this is not one of them. I love both languages and I’ll simply compare some of their features and possible uses."<p>This was an interesting post, and I'm sure the op didn't mean any of it as a "flame". Problem is, on a lot of the comparisons, the op just said "I won't get into this, but I prefer Python" (or Ruby, depending on the feature). Those kinds of statements don't really advance anyone's knowledge, but are sure to get some people annoyed.<p>As someone who uses Python but hasn't learned Ruby, this article got me to the same conclusion I alway get - while Ruby has a few very interesting differences and clever tricks I'd love to learn, it's so similar to Python that I'm better off learning a completely different language.<p>One thing I think is tiny, but incredibly helpful in Ruby, and I don't understand why more languages don't have it - the ability to add "?" and "!" to operators. That's an actually useful convention.
评论 #2513015 未加载
评论 #2513136 未加载
评论 #2513617 未加载
ctideabout 14 years ago
I thought it was a pretty good article until I got to:<p>"Since they are often used for the creation of webapps one should consider the deployment issue. Most web hosting companies provide cheap Python hosting, but very few companies provide Ruby hosting."<p>Which pretty much killed it. Doesn't Heroku alone pretty much blow this statement away?
评论 #2512973 未加载
jessedhillonabout 14 years ago
&#62; <i>Ruby’s REPL(irb) seems to me more advanced since it allows you to do TAB smart completion(amongst other things).</i><p>You can easily have tab completion and a bunch of other good stuff (like preserving history across sessions) with the Python REPL. You have to use the PYTHONSTARTUP environment variable to indicate a script that is run when the Python shell begins, and that script has to use adjust some rlcompleter and readline setttings.<p>It's all right here: <a href="http://docs.python.org/library/rlcompleter.html" rel="nofollow">http://docs.python.org/library/rlcompleter.html</a><p>Incidentally, this is the first result on Google for "python tab completion"