[Python-3000] PEP 3101 update

Michael Urman murman at gmail.com
Sat Jun 24 17:55:09 CEST 2006


On 6/23/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
> I like the internal counter concept though - it means that purely positional
> stuff can be written without any additional mental overhead, and with the
> braces being the only additional typing when compared to the status quo.
>
> That way, if you didn't have any field formatting you wanted to do, you could
> just write:
>
>    "{} picks up the {}. It is {}!".format(person, thing, adjective)

I don't like this, as it makes it easy to fall into a localization
trap which the original programmer may have no reason to predict.
While it would be possible to add indices to the translated format
string (unlike the usual C/C++ equivalent), it would make things much
more confusing, possibly tempting constructs like "{1} ... {0} ...
{}". I doubt most translators would be intimately familiar with
Python's format specification rules.

I would much prefer the consistent explicit counter (or lookup-key) in
the format specifier.

Michael
-- 
Michael Urman  http://www.tortall.net/mu/blog


More information about the Python-3000 mailing list