[Python-3000] PEP 3101 Updated

Eric Smith eric+python-dev at trueblade.com
Thu Aug 23 01:46:34 CEST 2007


James Thiele wrote:
> In the section "Explicit Conversion Flag" of PEP 3101 it says:
>> Currently, two explicit conversion flags are recognized:
>> !r - convert the value to a string using repr().
> !s - convert the value to a string using str().
> --
> It does not say what action is taken if an unrecognized explicit
> conversion flag is found.

My implementation raises a ValueError, which I think is the desired 
behavior:
 >>> "{0!x}".format(1)
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ValueError: Unknown converion specifier x
I agree the PEP should be explicit about this.


More information about the Python-3000 mailing list

AltStyle によって変換されたページ (->オリジナル) /