[Python-3000] More PEP 3101 changes incoming

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Aug 11 03:57:42 CEST 2007


Ron Adam wrote:
> 
> I'm not sure what you mean by "ditch all of these".

I was guessing that what's meant by returning a
(value, format_spec) tuple is to re-try the
formatting using the new value and spec. That's
what I thought was unnecessary, since the method
can do that itself if it wants.

> The output in this case is a null string. Setting the format spec to 
> None tell the format() function not to do anything more to it.

Then why not just return an empty string?

> The format function would first call the objects __format__ method and 
> give it a chance to have control, and depending on what is returned, try 
> to handle it or not.

Okay, I see now -- your format function has more smarts
in it than mine.

But as was suggested earlier, returning NotImplemented
ought to be enough to signal a fallback to a different
strategy.

--
Greg


More information about the Python-3000 mailing list