March 10, 2009
1:04 a.m.
On Mar 9, 2009, at 9:13 PM, Jan Kanis wrote:
def callback(param) as result with do_something(with_our(callback), other, args): print("called back with "+param) return foobar(param)
this would be equivalent to
def callback(param): print("called back with "+param) return foobar(param)
result = do_something(with_our(callback), other_args)
Not only the equivalent code looks much cleaner, the only good thing it actually do (not having to first define a function to then use it) can be accomplished with a decorator. Thanks GvR and all that finally shed some light in ruby blocks. I never understood what was so special about them, now I know it is nothing really. :) -- Leonardo Santagada santagada at gmail.com