Nice wrapper class Kirby! One thought: multiplying functions is another operation. I would tend to reserve '*' for that, or you will be confusing of limited. Since the raised circle is not a python operator, it appears you need to use a different, nonstandard composition symbol. Perhaps '%' (it has a raise circle as part of it :-) ). Then have the Function class do the basic arithmetic operations *and* composition.
On Dec 11, 2007 8:24 PM, kirby urner <[EMAIL PROTECTED]> wrote: > Got a green light for my talk @ Pycon, meaning I'll be doing a quick > run through some group theory stuff, as we teach pre-college in our > prototype Pythonic Math Class of the Future (what the talk is about). > > Here's a pertainent link: > http://mail.geneseo.edu/pipermail/math-thinking-l/2007-November/001211.html > > Note this idiom of using a decorator to wrap a function as a class > object, with __call__ made to pass through an argument for evaluation > (like it were still just a regular function) and __mul__ made to make > functions "composable" i.e. "objects that multiply" (our motive for > wrapping functions within objects in the first place i.e. to make use > of Python's special names, __mul__ in particular). > > Kirby > _______________________________________________ > Edu-sig mailing list > [email protected] > http://mail.python.org/mailman/listinfo/edu-sig > -- Andrew N. Harrington Director of Academic Programs Computer Science Department Loyola University Chicago 512B Lewis Towers (office) Snail mail to Lewis Towers 416 820 North Michigan Avenue Chicago, Illinois 60611 http://www.cs.luc.edu/~anh Phone: 312-915-7999 Fax: 312-915-7998 [EMAIL PROTECTED] for graduate administration [EMAIL PROTECTED] for undergrad administration [EMAIL PROTECTED] as professor _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
