function operators

phil hunt philh at comuno.freeserve.co.uk
Tue Nov 27 17:03:23 CET 2001


On Tue, 27 Nov 2001 01:43:34 +0000, James A. H. Skillen <jahs at jahs.org> wrote:
>Has anyone ever wished that Python had operators defined on functions?
>For example, suppose you want the function f(x) = cos(x) + sin(x).
>You could do:
>
>    def f(x):
>        return cos(x) + sin(x)
>
>or
>
>    f = lambda x: cos(x) + sin(x)
>
>but wouldn't:
>
>    f = cos + sin
>
>be *much* nicer?

No, it's horrible

>Does this make sense, or have I been doing too much mathematics? ;-)

The latter.

-- 
*** Philip Hunt *** philh at comuno.freeserve.co.uk ***




More information about the Python-list mailing list