[Python-3000] More PEP 3101 changes incoming
Ron Adam
rrr at ronadam.com
Mon Aug 6 10:40:32 CEST 2007
Greg Ewing wrote:
> 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.
It sounds like we are describing the same thing, but differ on "where" and
"when" things are done, but we still haven't worked out the "what" and
"how" yet.
I think we need to work out the details "what" from the bottom up and then
see "how" we can do those. So the questions I asked are still important.
What should happen in various situations of mismatched or invalid type
specifiers?
When should exceptions occur?
Then after that, what features should each format specifier have?
Then we can determine what is best for "where" and "when" things should be
done.
Cheers,
Ron
More information about the Python-3000
mailing list