[Python-3000] print() parameters in py3k

Fredrik Lundh fredrik at pythonware.com
Thu Nov 23 14:53:33 CET 2006


Barry Warsaw wrote:

>> 2) for convenience, extend print to treat a format object as a format
>> specifier for the following arguments:
>>
>>      print (x, y, z, fmt="My X: %s, Your Y: %s, His Z: %s")
>>
>> becomes
>>
>>      print(format("My X: %s, Your Y: %s, His Z: %s"), x, y ,z)
>>
>> 3) get rid of printf.
>
> That's not bad.  Is the format object allowed in any positional
> argument, or just the first?

any, I think.  you can either just let print collect all none-format objects and
pass it to the preceeding format object, or (better) ask the format object for
how many arguments it expects, and use a default formatter (i.e. str) on the
rest.

</F> 





More information about the Python-3000 mailing list