Nick Coghlan wrote:
def lazycall(x, *args, **kwds):
  """Executes x(*args, **kwds)() when called"""
  return lambda : x(*args, **kwds)()

It occurred to me that this should be:

def lazycall(x, *args, **kwds):
   """Executes x()(*args, **kwds) when called"""
   return lambda : x()(*args, **kwds)

(Notice where the empty parens are)

Then this does the right thing:

lazycall(lazy(attrgetter('a'), x), y) # x.a(y)

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to