[Python-checkins] r63655 - in python/trunk/Doc/tutorial: controlflow.rst datastructures.rst errors.rst floatingpoint.rst inputoutput.rst introduction.rst stdlib2.rst

Eric Smith eric+python-dev at trueblade.com
Tue May 27 13:44:47 CEST 2008

benjamin.peterson wrote:
> Modified: python/trunk/Doc/tutorial/controlflow.rst
> ==============================================================================
> --- python/trunk/Doc/tutorial/controlflow.rst	(original)
> +++ python/trunk/Doc/tutorial/controlflow.rst	Mon May 26 02:54:22 2008
> @@ -445,8 +445,8 @@
>  up in a tuple.  Before the variable number of arguments, zero or more normal
>  arguments may occur. ::
> -   def fprintf(file, format, *args):
> -       file.write(format % args)
> +   def fprintf(file, template, *args):
> +       file.write(template.format(args))

Not that it matters much, but this has a different meaning than the old 
example, where it was obvious that args would be a tuple.  In the new 
example, it's not likely you'd want args to be a tuple.  Maybe a better 
example would be something like:

def fprintf(file, *args):

Or, if you want more than argument before *args:

def fprintf(file, separator, *args):


More information about the Python-checkins mailing list