[Python-3000] PEP 3101 Updated

Talin talin at acm.org
Thu Aug 16 05:13:20 CEST 2007


Eric Smith wrote:
> James Thiele wrote:
>> The section on the explicit conversion flag contains the following line:
>>
>>       These flags are typically placed before the format specifier:
>>
>> Where else can they be placed?
> 
> I'd like this to say they can only be placed where the PEP describes 
> them, or maybe to be only at the end.
> "{0!r:20}".format("Hello")
> or
> "{0:20!r}".format("Hello")
> 
> Putting them at the end makes the parsing easier, although I grant you 
> that that's not a great reason for specifying it that way.  Whatever it 
> is, I think there should be only one place they can go.

Guido expressed a definite preference for having them be first.

>> Also there is no description of what action (if any) is taken if an
>> unknown explicit conversion flag is encoubtered.
> 
> I would assume a ValueError, but yes, it should be explicit.

This is one of those things I leave up to the implementor and then 
document later :)



More information about the Python-3000 mailing list