Should __future__ statements ever be phased out?

Hamish Lawson hamish_lawson at yahoo.co.uk
Tue Mar 20 18:31:01 CET 2001


The __future__ proposal envisages that future statements in a piece of
code will be phased out once the language change becomes standard.
(Many of the alternative proposals also envisage this.) Does this not
pose possible problems with running post-change-aware code on an
pre-change version of the interpreter?

Let me take a fanciful (and hopefully highly improbable!) example.
Suppose in Python 4.0 it is decided to introduce a change in the
semantics of the print statement so that it outputs its arguments in
uppercase. This change is inrended to become mandatory in Python 3.1
and those wanting the old behaviour after that will have to use write
statements. During the 4.0-to-4.1 transition I use a future statement
in my code to specify whether I want the old or the forthcoming
behaviour. After 4.1 comes out and I upgrade my interpreter, I phase
out all the print-related future statements from my code. However one
day I give my program to a friend who (unknown to me) is still running
Python 2.1. When he runs my program any print statements in it will
behave differently from what I intended, but without any warning.

Hamish Lawson


____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie




More information about the Python-list mailing list