Functional Programming

Aahz aahz at pythoncraft.com
Mon Dec 30 15:39:02 EST 2002


In article <x7k7hs9nb7.fsf at guru.mired.org>, Mike Meyer  <mwm at mired.org> wrote:
>
>class curry:
>   def __init__(self, func, *fixed_args):
>      self.func = func
>      self.fixed_args = fixed_args
>
>   def __call__(self, *variable_args):
>      return apply(self.func, self.fixed_args + variable_args)

Just as a reminder:

   def __call__(self, *variable_args):
      return self.func( *(self.fixed_args + variable_args) )
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"There are three kinds of lies: Lies, Damn Lies, and Statistics."  --Disraeli



More information about the Python-list mailing list