[Python-ideas] A suggestion for Python 3 vs Python 2

אלעזר elazarg at gmail.com
Tue Nov 12 18:08:40 CET 2013


2013/11/12 Steven D'Aprano <steve at pearwood.info>:
> I've written a few short utility scripts in my time, and I rarely call
> print directly except for the most basic scripts. Normally I'll have
> facility to control output, perhaps a verbosity level, or at least a
> verbose flag, say:
>
> def pr(message):
>     if gVerbose:
>         print message
>
And making print syntactically irregular prevents you from doing things like

import builtins
builtins.print = print_if_verbose

Elazar


More information about the Python-ideas mailing list