| > One thing I dont understand is > print word > where does "word" come from? >> def Monkey(word):
>> class _Monkey(object):
>> def shout(self):
>> print word
>> return _Monkey
Note that Monkey is a function that takes a parameter word. So every invocation of Monkey creates a class that will always .shout() the parameter word.> Anyway, this setup is in no way different to ruby's super > super("foo") super("bar") No. >> class Chimp(Monkey("foo")):
>> pass
>> class Gorilla(Monkey("bar")):
>> pass
You'll note that these two class definitions create a class Chimp that's descended from a class like _SomeMonkeyThatSaysFoo, and a class Gorilla that's descended from a class like _SomeMonkeyThatSaysBar.That is what the parent poster has challenged anyone to reproduce in Ruby. > Grow up. Use what you prefer, and end this stupid war. Programming language wars are at least as old as the Internet, so the admonition to "Grow up" hold no water in this case. I could quite reasonably parody your closing statement as: "Grow up. So who cares whether a hammer or celery makes a better tool? Just leave us alone, hammer-users." |