[Python-3000] Open Issues for string.format PEP

Guido van Rossum guido at python.org
Sat Apr 22 21:12:09 CEST 2006


On 4/22/06, Talin <talin at acm.org> wrote:
> 1) Whether to drop the optional parts of the proposal:
>    -- support for field expressions (was: locals() support)
>    -- support for direct access to current scope (was: locals() support)

I'd skip this. KISS etc.

> 2) Should this PEP be targeted at Python 2.6 or 3.0?

Both equally. We could implement it in the 3.0 branch first.

> 3) Role and usage of custom formatters:
>
>    "string".fformat( formatter, ... )
>
> vs.
>
>    MyFormat( "string" ).format( ... )
>
> (note: I want to make it clear that the purpose of custom formatters is to
> override the formatting on a *per-field basis*, but at the same time the
> custom formatter should have access to the surrounding context.)

I think a single format() method with a standard signature makes more
sense. That way you can abstract the choice of formatter out.

> 4) Should there be a way to pass in a dict argument without flattening it via
> **args?

Questionable. TOOWTDI; OTOH the flattening could be expensive. If we
can figure out a way to optimize away the flattening as long as the
callee is implemented in C, I'm in favor of dropping **kwds.

> 5) Should the implementation attempt to detect unused arguments?

I think so; the % operator is very strict about this and it's useful
in debugging.

> I'd like to get some sense of the answers before the next revision of the PEP.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list