On Wed, Jul 29, 2009 at 9:04 PM, alex23<wuwe...@gmail.com> wrote: > On Jul 30, 1:06 pm, r <rt8...@gmail.com> wrote: >> 1.) No need to use "()" to call a function with no arguments. >> Python --> "obj.m2().m3()" --ugly >> Ruby --> "obj.m1.m2.m3" -- sweeet! >> Man, i must admit i really like this, and your code will look so much >> cleaner. > > How do you distinguish between calling a method with no arguments, and > getting access to the method object itself (because it _is_ an object, > y'know, it's OO all the way down...)?
IIRC from the Pickaxe, to get at a method object, you call a method on the object whose specific job it is to return method objects. Unsurprisingly, this method is itself named "method". So: foo.bar #calls the "bar" method on foo foo.method(:bar) #returns the method "bar" of foo, as an object Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list