Unholy: _why's Ruby to Python compiler
github.com
github.com
But don't get me started on Java... ;-)
Also I'd highly recommend the movie Python from 2000, starring none other than Wil Wheaton trying to defend the small town of Ruby from an attack by a giant Python.
I'd recommend Scala even if you skip all the functional parts of it (Clojure's too un-java to speak as an alternative.)
As I saw it: There was this feeling that, after years of being dismissed as a mere scripting language, it was Python's time to shine — but then Ruby came along and (pushed along by Rails) was about to steal Python's thunder, and they were so similar that people thought there was only room for one such language in the New World Order. So Pythonistas began acting pretty rude toward the upstart Rubyists, and the Rubyists got this idea that Python was an evil, enemy technology.
But the whole thing is pointless anyway. Everyone should learn at least a little of both languages since they're both fantastic.
Why?
Just imagine the joy of using ZODB instead of EJB's layered on top of Oracle databases.
Zope was just a morass of over-complication. I remember buying the zope book sometime in the early 00s.
I was initially impressed with the completeness, but found it to be overly-complex and ugly to work with. Rails + Django happened for a reason.
Now, I haven't played with it in maybe 8 years, but I'd say pre-rails it was just not as elegant.
Neither Rails nor Django appeared on the radar before Zope 3 and Zope 3 is much a nicer platform than 2 (they applied a lot of lessons learned when making it). Grok is even more interesting, as it brings the convention over configuration to Zope 3 (Zope Corp does a lot of government contracts where, I assume, XML configuration files were mandated by clueless PHBs)
Also, had Zope been more successful at that time, it would have captured a lot of space that's now owned by Sharepoint and EJB messes.
Zope < 3.0 was a convoluted mess of two over-engineered applications named Bobo and Principia that were hacked together.
That's why the API had functions names like:
bobobase_modification_time
principia_is_folderish
That's why Zope 3 was rewritten from scratch.Zope 3 has a sane, albeit complex, architecture. Regretably it came too late into the game and by the time it was ready, every Python web developer had moved to turbogears or something else.
The only interesting piece of technology from Zope was the ZODB. I wish it had developed as a separate product.
Yes, Rails brought convention-over-configuration to the forefront of Ruby programming, but it wasn't the first library to do so…and it's had a lot of external influences as well. Remember that Rails3 is essentially Merb2, and that's heavily influenced by Rack as the backing mechanisms for networking.
Just in the Web arena, Rails is the big player, but Sinatra matters, as does Padrino. Ruby is still closer to Perl's TMTOWTDI than Python's "preferably one".
[Edited to fix typing errors from the iPad.]
OTOH the Python's "one way" is also not the point and is easily misunderstood.
I recently jumped into myriads of Python low-level webserver libs and engines - like say Sinatra. I had to investigate them thoroughly to decide what to use for our startup. There are dozens of them and each encourages some other style of programming. There wouldn't be so much of them if people went into "one way of doing things" church.
Ruby also has a bit of the "obvious way" (convention over configuration) stuff, but it's not as front-and-center as, say, the Zen of Python (where the obvious way stuff comes from, IIRC).
There's more in common than not in common between the two languages. I still prefer Ruby because it works the way my brain does (or, more accurately, there are choices made in Python design that do not work the way my brain does).
I spent the past week at a multi-lang conference in Montreal as part of the Ruby contingent. What i found is that most of the non-rubyists have a notion of Rails that is stuck back in 2007. Rails has changed a whole lot, particularly with version 3, and in doing so, has become a much better citizen in the Rubysphere, in particular it's integration with other libraries and tools. So in so far as that is the case, Rails follows a Rubyist paradigm now.
Second, i strongly disagree with the notion that the Ruby ethos and aesthetic "barely exist[s]". The number of Ruby conferences which do not have a rails focus that take place every year is quite large. Rails is and has been known to be different from Ruby, and once you are anywhere away from being a casual user of Rails, you will become familiar with the Ruby aesthetic by virtue of encountering libraries outside of Rails. The days of Rails plugins are gone.
I hear this said a lot, but where does this idea come from? Their object models are different, their syntax is different, their goals are different.
Admittedly, I haven't written much Python (my experience is mostly reading it), but that's primarily because I preferred Ruby and have never seen what Python brings to the table.
Python do not have annotations. Decorators are not like java annotations.
>>Why not take advantage of the explicit self?
I think "self" is good. Python lets you bloody patch python objects and classes in runtime and "self" makes it more clear.
Something like:
class MyClass(object): pass
def setX(self,x): self.x = x
MyClass.setX = setX
mc = MyClass()
mc.getX = lambda self: self.x
(INB4: I do not think that bloody patching is good practice)
Sorry, yes - wrong word. The point stands, though. For class methods to require the use of a feature as outside the core syntax as decorators just screams of a hacked-in afterthought.
> I think "self" is good.
I am indifferent to it, but the fact that the space in the syntax opened up by requiring an explicit receiver on all method definitions is not taken advantage of for class methods speaks volumes.
I think that classmethods was added only for java/C# folks.
In fact it's always better just to combine defs in module and use it as module.method.
I like the approach in Scala with "objects" (Scala-singletones).
About "self": I don't understand you. Can you show me a language with optional (not forced) OOP, that lets you bloody patch objects and classes that deals with this problem in better way?
This theory applies to some other conflicts such as Hells Angels vs. Bandidos, Emacs vs. Vim, Sunni muslims vs. Shia muslims, Christians vs. Protestants etc.
1) http://en.wikipedia.org/wiki/Narcissism_of_small_differences
I was walking across a bridge one day, and I saw a man standing on the edge, about to jump off. So I ran over and said, "Stop! Don't do it!" "Why shouldn't I?" he said. I said, "Well, there's so much to live for!" He said, "Like what?" I said, "Well, are you religious or atheist?" He said, "Religious." I said, "Me too! Are your Christian or Buddhist?" He said, "Christian." I said, "Me too! Are you Catholic or Protestant?" He said, "Protestant." I said, Me too! Are your Episcopalian or Baptist? He said, "Baptist!" I said, "Wow! Me too! Are your Baptist Church of God or Baptist Church of the Lord? He said, Baptist Church of God!" I said, "Me too! Are your Original Baptist Church of God or are you Reformed Baptist Church of God?" He said, "Reformed Baptist Church of God!" I said, "Me too! Are you Reformed Baptist Church of God, Reformation of 1879, or Reformed Baptist Church of God, Reformation of 1915?" He said, "Reformed Baptist Church of God, Reformation of 1915!" I said, "Die, heretic scum!" and pushed him off.
Aman has provided some comments, discussion, and code back to RubyPython over the last few days. I know this because I've been chatting with him and pulling his modifications back into the main GitHub repo[1] (which happens to be mine) and pushing them back into the canonical repo on Bitbucket[2] (which is the original creator's repo).
RubyPython was created in 2008 by Zach Raines, rewritten to use FFI in late 2010. Steeve Morin forked it as Rupy (apparently with Zach's blessing as Zach pointed me to it when I posted a bug fix to Zach's code) earlier this year. I got involved shortly after Steeve's fork. After some discussion, we (Steeve, Zach, and I) unforked Rupy back into RubyPython and opened the project a bit wider. I'm currently working on a new release (0.5) that should be out later this week that unifies the two repositories and includes some fixes and enhancements by Aman.
We're using Schacon's wonderful hg-git[3] for navigating between git and hg.
[1] https://github.com/halostatue/rubypython [2] https://bitbucket.org/raineszm/rubypython/ [3] https://hg-git.github.com/
A practical reason: Ruby doesn't have the depth of Python libraries, get more done in less time.[0] A theoretical reason: reading through the docs you find that 'decompyle' is based on 'spark' (John Aycock's generic small languages compiler), learning new things about languages & compilers is good. A philosophical reason: studying _whys' code is like finding some lost Greek classic from the library of Alexandria. Worthy of reading, just to see how a hacker works this problem, thus making it timeless.
[0] At the time the code was written.
If/when I release my programming mixtape - in which i'll spite hot fire about unit testing and my gripes with MVC - he'll definitely get a spot in the liner notes. haha :)