[Python-3000] More PEP 3101 changes incoming

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Aug 6 08:44:05 CEST 2007


Ron Adam wrote:
> If the string __format__ method got 'k10' as a format specifier, it has 
> no idea what the 'k10' is suppose to mean, it needs to make a choice to 
> either fall back to str(), or raise an exception that could be caught 
> and handled.

I think Guido's scheme handles this okay. Each type's
__format__ decides whether it can handle the format
spec, and if not, explicitly delegates to something
else such as str(self).__format__. Eventually you
will get to a type that either understands the format
or has nowhere left to delegate to and raises an
exception.

--
Greg


More information about the Python-3000 mailing list