[Tutor] function algebra

Gregor Lingl glingl at aon.at
Fri Oct 31 11:23:51 EST 2003



Abel Daniel schrieb:

> ...
>
>I couldn't stand not doing it :)
>It's a bit less readable, but should handle any numerical operation.
>It also handles the case of "f=Fun(math.sin) + 5" (so that in this case
>f(x) will be math.sin(x) + 5), plus it does composition:
>  
>

Many thanks for this wonderfully crafted solution to
your "exercise left to the reader"!
Gregor
-----------------
P.S.: I'm still curious if anybody knows why module Canvas of Tkinter
is deprecated.

>------8<-------------
># we don't need to add __iadd__ and such as those fall back to using
># __add__ etc.
>unary_operators=['__neg__',....
>  
>




More information about the Tutor mailing list