Pep 3105: the end of print?

Klaas mike.klaas at gmail.com
Fri Feb 16 16:48:29 EST 2007


On Feb 16, 6:01 am, "Edward K Ream" <edream... at charter.net> wrote:

> That's the proof.  Can you find a flaw in it?

Casting this in terms of theorem proving only obfuscates the
discussion.

Here is how to maintain a single codebase for this feature:

1. Convert all your print statements to 3.0 print functions, named
something else (say, print2())
2. define a module called compat26 containing:

def print2(*args, **kwargs):
    # code to convert the above to print statements (better still,
sys.stdout.write())

3. in your code:
try:
    from compat26 import print2
except (ImportError, SyntaxError):
    # python 3.0
    print2 = print

-Mike




More information about the Python-list mailing list