On 04/27/10 10:36, Keith wrote: > I think it's worth making the print statement (or print function, as > the case may be) let us do engineering notation, just like it lets us > specify scientific notation.
The print statement/function does no magic at all in specifying how numbers look like when. The apparently magical formatting is done by the %-operator and for {}-style formatting, the obj.__format__(). If you're using the {}-format, you can override .__format__() to define your own formatting mini-language. If you need to, you can monkey patch format() so that it wraps int/float in Engineer wrapper that defines Engineer.__format__() to whatever formatting style you're using. -- http://mail.python.org/mailman/listinfo/python-list