[Python-Dev] Replacement for print in Python 3.0

Trent Mick trentm at ActiveState.com
Tue Sep 6 20:02:44 CEST 2005

[Barry Warsaw wrote]
> Also, we already have precedence in format+print in the logging
> package.  I actually think the logging provides a nice, fairly to use
> interface that print-ng can be modeled on.

The main reason for doing that in the logging package is for
performance: processing the args into the format string can be deferred
until the logging system knows that the log message will actually be
used.  I'm not saying that the separation of 'fmt' and args in the
logging methods doesn't have the other benefit of clarity:

    log.debug("%s %s %s %s ...", arg1, arg2, arg3,
              really_really_long_arg4,)                      # nicer
    log.debug("%s %s %s %s ..." % (arg1, arg2, arg3,
                                   really_really_long_arg4)) # icky

but the performance reason doesn't apply to the printf()/write()
discussion here.


Trent Mick
TrentM at ActiveState.com

More information about the Python-Dev mailing list