[Python-3000] More PEP 3101 changes incoming

Ron Adam rrr at ronadam.com
Tue Aug 7 04:53:26 CEST 2007



Greg Ewing wrote:
> Ron Adam wrote:
>> What should happen in various situations of mismatched or invalid type 
>> specifiers?
> 
> I think that a format string that is not understood
> by any part of the system should raise an exception
> (rather than, e.g. falling back on str()). Refuse the
> temptation to guess.

That handles invalid type specifiers.


What about mismatched specifiers?

Try to convert the data?

Raise an exception?

Either depending on what the type specifier is?


I think the opinion so far is to let the objects __format__ method 
determine this, but we need to figure this out what the built in types will do.


Ron




More information about the Python-3000 mailing list