Jeremy Bowers wrote: > > A step which will require him to tell the printing routine how many digits > > he wants printed. > > Not necessarily; consider the str() of a float in Python, especially given > the "significant digits" aspect (it may be ill-defined, but I can think of > several well-defined ways to mean that, where str() embodies one of them). > The easiest way to tell how long the number will be when str prints it out > is to simply ask it.
and what language is str() implemented in? > In C++, this may be harder, as your output software may insist on > rendering everything directly, with no way to reach in and tell what it > did. Imagine the standard IOStreams, without the ability to stream into a > string. but you can stream into a string buffer, and you can use sprintf() from C++, so what's your point, besides stating that "if things were harder, they would be harder"? </F> -- http://mail.python.org/mailman/listinfo/python-list