[Python-3000] More PEP 3101 changes incoming

Talin talin at acm.org
Thu Aug 2 07:40:32 CEST 2007


Ron Adam wrote:

> Splits the item and it's formatter.  The alignment is more of a 
> container property or feild property as you pointed out further down.
> 
> So maybe if you group the related values together...
> 
>     {valuespec:format, alignment:width}
> 
> This has a nice dictionary feel and maybe that may be useful as well. 
> Reusing things I'm familiar with does make it easier.

I'm certainly open to switching the order of things around. Remember, 
though, that we have *5* fields (6 depending on how you count) of 
formatting options to deal with (see the PEP for details):

    -- alignment
    -- padding char
    -- minwidth
    -- maxwidth
    -- fractional digits
    -- type

...And we need to be able to represent these succinctly. That last is 
important and here's why: None of these formatting codes are necessary 
at all, because in the final analysis you can get the same effect by 
wrapping the arguments to format() with the appropriate padding, 
alignment, and type conversion function calls.

In other words, the whole point of these format codes is that they are 
convenient shortcuts. And shortcuts by definition need to be *short*.

So we need to strike a balance between convenience and readability.

-- Talin


More information about the Python-3000 mailing list