PEP 236: Back to the __future__

Tim Peters tim.one at home.com
Tue Feb 27 20:29:07 EST 2001


[D-Man]
> ...
> However, I would like to see the use of particular future_statements
> deprecated or even disallowed after the feature becomes mandatory.

It's deliberately not done that way, so that if someone who moves their code
around a lot happens to move to an earlier release, the (earlier) compiler
will complain about a __future__ request it can't satsify.  This is up to
each programmer to deal with in whichever way best fits their usage.  I
expect many users will ignore future_statements entirely, and simply wait for
the next release before fiddling their code.  That's fine too.

Note that there's more than enough info in __future__.py to allow writing a
tool in Python that can reliably search for, identify, and even delete (if
you like) obsolete future_statements wrt to any fixed Python release.  That
was also deliberate.

> As for the future statement being easy to find :
>     grep -r "__future__" my_source_tree/*
> will do the job ;-).

The syntax restrictions listed in the PEP also ensure that a future_statement
begins with "from" starting in the first column (they CANNOT be nested in if
or try blocks, etc).

everything-about-them-is-simple-except-the-implementation<wink>-ly y'rs
    - tim





More information about the Python-list mailing list