On 8/2/07, Brandon Craig Rhodes <[EMAIL PROTECTED]> wrote:
> "Guido van Rossum" <[EMAIL PROTECTED]> writes:
>
> > My personal suggestion is to stay close to the .NET formatting language:
> >
> >   name_specifier [',' width_specifier] [':' conversion_specifier]
>
> A problem is that this format requires brute memorization to remember
> where to put things.  If letters were used to prefix specifications,
> like "w" for width and "p" for precision, one could write something
> like:
>
>    >>> 'The average is: {0:w8p2} today.'.format(avg)
>    'The average is:     7.24 today.'
>
> This would give users at least a shot at mnemonically parsing - and
> constructing - format strings, and eliminate the problem of having to
> decide what goes first.
>
> If, on the other hand, all we have to go on are some commas and
> colons, then I, for one, will probably always have to look things up -
> just like I always did for C-style percent-sign format specifications
> in the first place.

I fully expect having to look up the *conversion specifier* syntax,
which is specific to each type. But I expect that the conversion
specifier is relatively rarely used, and instead *most* uses will just
use the width specifier. The width specifier is so simple and
universal that one will quickly remember it. (Experimentation is also
easy enough.)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to