On 8/22/07, Eric Smith <[EMAIL PROTECTED]> wrote: > 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
You raise ValueErrors for other errors with the format, right? If there's a reason to be more lenient, the best approach would probably be to interpret it as !r. > I agree the PEP should be explicit about this. -- --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