[docs] "knights of Ni" bug

Sandro Tosi sandro.tosi at gmail.com
Mon Apr 11 20:34:25 CEST 2011


Hi Martin,

On Fri, Apr 8, 2011 at 00:08, Martin Feuchtwanger <martinf at underhill.ca> wrote:
> Hello,
>
> I'm very new to Python -- going through the Tutorial
> at http://docs.python.org/tutorial/inputoutput.html
> -- using 2.6.4 (r264:75708, Oct 26 2009, 08:23:19)
> [MSC v.1500 32 bit (Intel)]
>
> I think the following is wrong:
>
> 	>>> print 'We are the {} who say "{}!"'.format('knights', 'Ni')
> 	We are the knights who say "Ni!"
>
> and should be:
>
> 	>>> print 'We are the {0} who say "{1}!"'.format('knights', 'Ni')
> 	We are the knights who say "Ni!"
>
> or am i missing something?

Benjamin already replied to the other email, and I'm here just to
reply also to this email.

Why do you think you have to explicitly state the position of the
objects in the {} format? the numbers can be use to specify a position
of the objects passed to the string, but if you want to print them as
they are passed, there's no need to enumerate them.

Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi


More information about the docs mailing list