[Python-Dev] Replacement for print in Python 3.0 (original) (raw)

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Sat Sep 3 22:01:24 CEST 2005


On Sat, 2005-09-03 at 19:42 +0100, Paul Moore wrote:

On 9/3/05, James Y Knight <foom at fuhm.net> 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...

I have to agree. While I accept that Barry has genuine use cases for the printf form, I don't quite see why %-formatting isn't enough. Is the print-plus-% form so much less readable and/or maintainable?

printf does avoid one extra set of () in many cases, making the code look and indent nicer.

I take this chance to state my humble opinion. Please keep the print function print(), not writeln()! "printing stuff" is everyone's favorite anachronistic expression, even though the output doesn't go to a printer anymore. We all love it! I know Guido wanted a different name so that print() could be introduced in python 2 to allow a smooth transition to python 3, but the disadvantages in lost readability and familiarity by far outweigh the transition concerns imho.

Regards.

-- Gustavo J. A. M. Carneiro <gjc at inescporto.pt> <gustavo at users.sourceforge.net> The universe is always one step beyond logic



More information about the Python-Dev mailing list