I thought it was a pretty good article until I got to:
"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."
Which pretty much killed it. Doesn't Heroku alone pretty much blow this statement away?
I just mean that it implies that finding cheap hosting for a ruby webapp is problematic. If the purpose of that statement is to say that more places will support Python than Ruby, then it should probably be worded differently.
Heroku may be a good value for what it is, but it's vastly more expensive than a lot of entry-level shared hosting services - you know, the kind of place that starts at $5 or $10 per month and runs cPanel or an equivalent. Lots of those support Python these days; Ruby support still seems to be much rarer.
Heroku's free hosting is leaps and bounds beyond what a typical $5-$10 shared host offers, and there's an easy upgrade path. Sure, you can come up with specific usage levels where a shared host is cheaper on a bit-to-dollar basis, but you're still not accounting for Heroku's main selling point: convenience and saving developer time. This plus the fact that the vast majority of sites on $5-$10 shared hosting would fit easily on Heroku's free plan means that value-wise, Heroku faces much stiffer competition from Linode than any shared provider.
I like and am comfortable with both Python and Ruby, and one of the biggest reasons I choose Rails for projects nowadays is Heroku, and I'm not alone. Given this, I really don't see how you could claim Python has any edge when it comes to hosting. If you're concerned about what tons of shared hosting providers have installed, why not just use php?
We support Rails at HostGator.com, either using cPanel-managed Mongrel or through a FCGI dispatcher (I personally assist with multiple set-ups daily). Perhaps not as ideal for a 100% Rails shop as Heroku, but the option is definitely there.
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.
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.
When languages are as close as Ruby and Python (or C# and Java), frameworks/ecosystem/community matters a ton more.
You might think it's more polished because you know the ecosystem better but pip does the same thing as gem & bundler, virtualenv the same as rvm and fabric the same as capistrano. I have the same problem you have, I can't for the life of me see the point of learning Ruby and because of that I never give it a fair chance.
I totally think you can be right about my perspective.
I can tell you my last expedition in Python land was bad. I ran into two problems: upgrading the version of Python that came on my Air and installing MongoEngine. For MongoEngine I used the instructions on their website "easy_install -U mongoengine". And after a bit of googling (I say a bit because a lot of people were having the same problem I was) I ended up installing PIP (via easy_install no less!) and then got into pathing problems.
Having to use one package manager to install a better package manager isn't polish. Again, I can agree that this might all just be familiarity and comfort (or lack of in this case).
I'm not so open to Django vs Rails though. I don't need to do a lot of struts to see how horrible it is (compared to anything). I don't need to do a lot of Django to see that it's behind Rails as a productive web frameworks. I'm not completely closed to the possibility that i'm just an idiot, but at this point it would likely take working with a guru for a couple weeks to change my mind.
I share a similar sentiment, last encounter with Ruby was fixing an ex-contractor's app which didn't use bundler and relied on a different version of ruby. The fact that I had to spend two days trying different versions of backward incompatible dependencies together didn't really endear me to Ruby or Rails. In contrast, there's a much higher emphasis on backwards compatibility in Python and a lot less on monkey-patching. As for Django vs Rails, don't have enough experience with Rails to comment. The little I time I've spent in Rails I didn't like, there was too much magic in there to properly see what was going on and the automatic imports don't help with that either.
Btw, I went with MongoKit after running into some index troubles using MongoEngine, worked like a charm.
To be fair, the problems you were having are OS X problems, not python. I used OS X and had the same problems (before that, I used windows, and it was much better). In the end, I installed Ubuntu and development has been a dream ever since.
Hint: pip -E yourenvdir install yourpackage
That will create a virtualenv and install the package there. You can just delete the env when you're done. You really shouldn't install things system-wide, generally...
I suppose some things fit in one mental's model more easily whereas others don't, and there's no reason to contrive yourself in doing so, especially given how close Python and Ruby are in the general landscape of all programming languages.
For reference, each element of the Ruby ecosystem has a similar Python counterpart.
- gem -> easy_install or pip
- rvm -> virtualenv
- capistrano -> fabric
- rails -> django
- sinatra -> itty, bottle, web.py, or twisted http module
Of course they're not 1:1 mappings, but python itself is not a 1:1 mapping to ruby, and any project is not a 1:1 mapping to any other project aiming to solve the same task either.
Admittedly it seems that Rails pushed Ruby more towards web development resulting in some more polish, whereas Python became more of a generalist, but that's a slight advantage either way, and they are definitely not worlds apart.
As I said in another comment..my easy_install/pip experience wasn't polished, but yes, that might just be me.
The rails -> django thing is where I'm not so humble. It didn't take me more than 5 minutes of doing Windows Mobile (6) programming to know that it sucked. Django doesn't suck (no way), but it isn't where Rails is. And I really think that, if you're doing web dev, the web framework is as important as all the other smaller pieces (package management, deployment, ...) put together.
Some people like magic, and some people like underscores. That's why they make chocolate and vanilla ice cream flavors. I don't think the goal of the Django team is to ever get to where Rails is, there are plenty of other frameworks trying to do that.
I find it comes down more to personal taste, but being tech type people we keep trying to justify intangible things like taste in terms of features etc.
Some people love Python and can't see what all the fuss is about with Ruby, others do the opposite. They're both excellent languages but you'll almost always find yourself leaning toward one over the other. This isn't because one's better, but just that it works closer to the way you think
"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."
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.
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.
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.
> 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.
My primary languages are Ruby and C. After working in Ruby for a while and then switching back to C I often find myself naming predicates with a trailing _q. I don't have an equivalent for !, though.
While the '!' addition to methods is an useful convention, having both collect, and collect! methods, and for example only a delete method for arrays (which does change the array it is called on), and similar inconsistencies in libraries, can occasionally lead to unnecessary API-lookups/bugs.
(I have been using Ruby (in a FOSS/academic setting) for a couple of years now (and I know Python too, though still prefer Ruby over it))
I once asked on #python why "?" is not allowed in names of identifiers. People responded by saying that Python prefered cleaner names. So, it was just an aesthetic preference.
> Ruby’s REPL(irb) seems to me more advanced since it allows you to do TAB smart completion(amongst other things).
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.
"but python + any python IDE < Java + IntelliJ IDEA(Eclipse/NetBeans)" (and I suppose s/python/ruby/g and s/Java/C#/g too)
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.
This has been my experience as well. IntelliSense, import resolution, auto refactoring etc are all good, but I always find myself going back to vim because I've finished editing by the time eclipse starts up...
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.
It actually makes python a full-blown shell (which python REPL is not):
$ ipython
Leopard libedit detected.
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
Type "copyright", "credits" or "license" for more information.
IPython 0.10.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: ls
Applications/ Downloads/ Movies/ Public/ Workspace/
Desktop/ Dropbox/ Music/ Sandbox/
Documents/ Library/ Pictures/ Sites/
In [2]: ls | grep App
Applications/
In [3]:
The advantages of using a REPL versus just coding is that you can test some things out before writing the code. To be honest, I don't use it much while programming, but it's indispensable for doing some Django queries or for playing with live code (you can run it in the shell and break to inspect the stack).
Its advantage over the stock Python repl is that it has better code completion, colours, pretty printing, nice history, built-in profiling and many other niceties I enjoy.
> Ruby and Python do not have statements - only expressions.
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:
Other Python statements from the top of my head: for, while, def, import.
My point is that there absolutely are statements that are not expressions in Python. (You can easily tell by trying to assign the return value: x=<statement>).
Heck, assignment itself is a statement. That's why you can't say while x=y: ... (and you'll notice the REPL gives no return value for an assignment).
This "Python has no statements" error was one of my biggest annoyances with this article, as Python has a very strong statement vs expression dichotomy.
Barring the fact that print became a function in Python 3 (and in Python 2.6+ with `from __future__ import print_function`), Python functions actually `return None` when the end of scope is reached, and indeed Python REPL does not show `None` being returned.
41 comments
[ 3.2 ms ] story [ 124 ms ] thread"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."
Which pretty much killed it. Doesn't Heroku alone pretty much blow this statement away?
Not really - he said "very few", not "there aren't any". You can find mod_python all over the place - where are your shared ruby hosting options?
I like and am comfortable with both Python and Ruby, and one of the biggest reasons I choose Rails for projects nowadays is Heroku, and I'm not alone. Given this, I really don't see how you could claim Python has any edge when it comes to hosting. If you're concerned about what tons of shared hosting providers have installed, why not just use php?
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.
When languages are as close as Ruby and Python (or C# and Java), frameworks/ecosystem/community matters a ton more.
This is exactly why I use Python over Ruby: scipy, numpy, matplotlib, etc.
The right language + ecosystem will obviously be very domain dependent.
I can tell you my last expedition in Python land was bad. I ran into two problems: upgrading the version of Python that came on my Air and installing MongoEngine. For MongoEngine I used the instructions on their website "easy_install -U mongoengine". And after a bit of googling (I say a bit because a lot of people were having the same problem I was) I ended up installing PIP (via easy_install no less!) and then got into pathing problems.
Having to use one package manager to install a better package manager isn't polish. Again, I can agree that this might all just be familiarity and comfort (or lack of in this case).
I'm not so open to Django vs Rails though. I don't need to do a lot of struts to see how horrible it is (compared to anything). I don't need to do a lot of Django to see that it's behind Rails as a productive web frameworks. I'm not completely closed to the possibility that i'm just an idiot, but at this point it would likely take working with a guru for a couple weeks to change my mind.
Btw, I went with MongoKit after running into some index troubles using MongoEngine, worked like a charm.
Hint: pip -E yourenvdir install yourpackage
That will create a virtualenv and install the package there. You can just delete the env when you're done. You really shouldn't install things system-wide, generally...
- stock python 2.6.1 and /Library/Python/2.6/site-packages
- brew install python (which brings in python 2.7)
- brew install python3
... and a bunch of virtualenvs
For reference, each element of the Ruby ecosystem has a similar Python counterpart.
- gem -> easy_install or pip
- rvm -> virtualenv
- capistrano -> fabric
- rails -> django
- sinatra -> itty, bottle, web.py, or twisted http module
- bundler -> setuptools (install_require directive)
also,
- rake -> scons, paver
- rspec -> unittest / unittest2 /nose
- watchr -> autonose
- rdoc markdown -> docstrings+restructured text
Of course they're not 1:1 mappings, but python itself is not a 1:1 mapping to ruby, and any project is not a 1:1 mapping to any other project aiming to solve the same task either.
Admittedly it seems that Rails pushed Ruby more towards web development resulting in some more polish, whereas Python became more of a generalist, but that's a slight advantage either way, and they are definitely not worlds apart.
The rails -> django thing is where I'm not so humble. It didn't take me more than 5 minutes of doing Windows Mobile (6) programming to know that it sucked. Django doesn't suck (no way), but it isn't where Rails is. And I really think that, if you're doing web dev, the web framework is as important as all the other smaller pieces (package management, deployment, ...) put together.
Some people love Python and can't see what all the fuss is about with Ruby, others do the opposite. They're both excellent languages but you'll almost always find yourself leaning toward one over the other. This isn't because one's better, but just that it works closer to the way you think
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.
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.
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.
My primary languages are Ruby and C. After working in Ruby for a while and then switching back to C I often find myself naming predicates with a trailing _q. I don't have an equivalent for !, though.
(I have been using Ruby (in a FOSS/academic setting) for a couple of years now (and I know Python too, though still prefer Ruby over it))
More here: http://coding.derkeiler.com/Archive/Python/comp.lang.python/...
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.
It's all right here: http://docs.python.org/library/rlcompleter.html
Incidentally, this is the first result on Google for "python tab completion"
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.
Could you outline what you see are the main benefits of using an enhanced interactive interface to Python such as IPython?
Its advantage over the stock Python repl is that it has better code completion, colours, pretty printing, nice history, built-in profiling and many other niceties I enjoy.
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:
Whereas in Python, we get a syntax error[edit: sorry, yes, i agree the general problem remains.]
My point is that there absolutely are statements that are not expressions in Python. (You can easily tell by trying to assign the return value: x=<statement>).
This "Python has no statements" error was one of my biggest annoyances with this article, as Python has a very strong statement vs expression dichotomy.