Why "from __future__" stinks; a counter-offer

Neil Schemenauer nas at arctrix.com
Tue Mar 20 05:17:29 CET 2001


On Tue, Mar 20, 2001 at 12:59:56AM +0000, Will Newton wrote:
> How often is this "from __future__" expected to be used?
> 
> Just experimental code written for bleeding edge versions of Python or a 
> significant portion of code (that will eventually become legacy code)?

Argh!  Read the PEP people.  Let me try to explain.  First
scenario, you don't need nested scopes and you don't think you
have any code that breaks with them:

    1. You upgrade to 2.1.

    2. You upgrade to 2.2.

Life is good and no "ugly" __future__ statements have entered the
picture.  Scenario 2, you want to use nested scopes in 2.1:
    
    1. You upgrade to 2.1.

    2. In modules where you want to use nested scopes you use
       the __future__ mechanism to enable them.

    3. You upgrade to 2.2.

    4. You use the handy tools provided to remove all traces of
       "from __future__ import nested_scopes"

Now you have 2.2, you are using nested scopes and there are still
no __future__ statements around.  Scenario 3, you have code that
will break with nested scopes:

    1. You upgrade to 2.1.

    2. Using the nice warnings provided you fix code that
       will break with 2.2.

    3. You upgrade to 2.2.

Again, no __future__ statements.  Please read the PEP and
understand what problem is being solved.  Dispite Tim's careful
explainations people still seem to have the idea that __future__
is a general switch for enabling language features.

  Neil




More information about the Python-list mailing list