scoping weirdness

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Mon Aug 27 12:57:39 CEST 2001


Mon, 27 Aug 2001 12:06:21 +0200, Alex Martelli <aleax at aleax.it> pisze:

> def curry_to_argumentlessness(*args, **kwds):
>     def totally_curried_function():
>         return args[0](*args[1:],**kwds)
>     return totally_curried_function

A little bit nicer:

  def curry_to_argumentlessness(fun, *args, **kwds):
      def totally_curried_function():
          return fun(*args, **kwds)
      return totally_curried_function

or:

  def curry_to_argumentlessness(fun, *args, **kwds):
      return lambda: fun(*args, **kwds)

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list