This may be old news for most people using Numeric Python on a daily basis, but I've just "discovered" that Numeric ufuncs can be applied to class instances, if they implement the right interface, which is a method with the same name as the ufunc.
One dumb example :
class ZeroAngle: def sin(self): return 0. def tan(self): return 0 def cos(self): return 1a = ZeroAngle() import Numeric as n print n.cos(za) print n.sin(za)
This of course does not work with the functions in math or cmath, which try to coerce there argument to float.
A very nice usage of this is in Konrad Hinsen's Scientific.Functions.Derivatives (part of the Scientific Python package)