[Python-3000] More PEP 3101 changes incoming
Guido van Rossum
guido at python.org
Sun Aug 5 04:09:45 CEST 2007
On 8/4/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Ron Adam wrote:
> > Which would result in a first column that right aligns, a second column
> > that centers unless the value is longer than 100, in which case it right
> > align, and cuts the end, and a third column that left aligns, but cuts off
> > the right if it's over 15.
> All this talk about cutting things off worries me. In the
> case of numbers at least, if you can't afford to expand the
> column width, normally the right thing to do is *not* to cut
> them off, but replace them with **** or some other thing that
> stands out.
> This suggests that the formatting and field width options may
> not be as easily separable as we would like.
I remember a language that did the *** thing; it was called Fortran.
It was an absolutely terrible feature. A later language (Pascal)
solved it by ignoring the field width if the number didn't fit -- it
would mess up your layout but at least you'd see the value. That
strategy worked much better, and later languages (e.g. C) followed it.
So I think a maximum width is quite unnecessary for numbers. For
strings, of course, it's useful; it can be made part of the
string-specific conversion specifier.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000