function operators

David Glasser news at davidglasser.net
Tue Nov 27 03:56:45 CET 2001


Hans Nowak <wurmy at earthlink.net> wrote:

>     def __add__(self, other):
>         assert isinstance(other, ComposableFunction)
>         def glue(*args):
>             return self.f(*args) + other.f(*args)
>         return glue

To make it even cleaner, how about 'return ComposableFunction(glue)'?

-- 
David Glasser
news at davidglasser.net               http://www.davidglasser.net/



More information about the Python-list mailing list