[Python-Dev] Replacement for print in Python 3.0
James Y Knight
foom at fuhm.net
Mon Sep 5 04:06:54 CEST 2005
On Sep 4, 2005, at 12:51 PM, Barry Warsaw wrote:
> On Sat, 2005-09-03 at 12:51, James Y Knight wrote:
>
>> On Sep 3, 2005, at 11:32 AM, Barry Warsaw wrote:
>>
>>
>>> So I think it's best to have two builtins:
>>>
>>> print(*args, **kws)
>>> printf(fmt, *args, **kws)
>>>
>>
>> It seems pretty bogus to me to add a second builtin just to apply the
>> % operator for you. I've always really liked that Python doesn't have
>> separate xyzf functions, because formatting is an operation you can
>> do directly on the string and pass that to any function you like.
>> It's much cleaner...
>>
>
> Actually, we probably only /need/ printf(), and certainly for C
> programmers (are there any of us left? ;), I think that would be a
> small
> conceptual leap. The motivation for keeping a non-formatting
> version is
> for simple cases, and beginners -- both of which use cases should
> not be
> dismissed.
No, we certainly don't /need/ printf(), as is well proven by its
current absence. Having the operation of printing and the operation
of string formatting be separated is good, because it means you can
easily do either one without the other. I don't understand why you
want to combine these two operations. If it's % you object to, then
propose a fix for the actual problem: e.g. a "fmt" function for
formatting strings. (Which I would also object to, because I don't
believe % is a problem). But proposing "printf" just adds
complication for no purpose. It leaves % as a "problem" and adds a
new builtin which duplicates existing functionality.
James
More information about the Python-Dev
mailing list