[Python-ideas] String formatting and namedtuple

Guido van Rossum guido at python.org
Mon Feb 16 22:51:18 CET 2009


On Mon, Feb 16, 2009 at 11:59 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> Bruce Leban wrote:
>>
>>
>> On Thu, Feb 12, 2009 at 11:24 AM, Terry Reedy <tjreedy at udel.edu
>> <mailto:tjreedy at udel.edu>> wrote:
>>
>>
>>    PROPOSAL: Allow the simple case to stay simple.  Allow field names
>>    to be omitted for all fields in a string and then default to 0, 1,
>>    ... so that example above could be written as
>>
>>    > >> msg = "{} == {}".format
>>
>>    Given that computers are glorified counting machines, it *is* a bit
>>    annoying to be required to do the counting manually.
>>
>>
>> Explicit syntax is better imho:
>> "The answers are {.} and {.}.".format(x,y)
>>
>> I'm suggesting a bare dot because it looks like something rather than
>> nothing and this syntax is currently invalid.
>
> -1
> There is nothing 'explicit' about '.'.
> {} is just as currently invalid.
> The purpose of my proposal is to make the simple case simple.
> In terms of keystrokes, unshift - . - shift is as bad as unshift - 0 -
> shift.

Well said.

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



More information about the Python-ideas mailing list