So what's wrong with __future__? (Was Re: Why "from __future__" stinks ...)

Tim Peters tim.one at home.com
Sun Mar 25 04:10:47 EST 2001


[Huaiyu Zhu]
> I don't quite see what the complaint about __future__ is really about.
> So let me try to analyze a little bit.  Maybe this could encourage
> someone to write a PEP to clarify.
>
> What's wrong with import __future__?
> ...

Oh, I don't think it's hard to grasp the primary complaint:  it's a hack!
Nobody in their right mind would *expect* an import statement to have
profound effects on the syntax and/or semantics of the module containing the
import, and it's un-Pythonically surprising to abuse import statements this
way.

OTOH, it was the best hack we could dream up under the constraints that (a)
we had to dream up *something*; (b) it had to be 100% backward compatible, no
exceptions no way no how; and, (c) since it was late in the release cycle,
any form of new syntax was a non-starter (there was no conceivable way to
make time to adjust all the tools we ship, let alone pull that trick  with
such scant warning on other people supplying Python tools).

It will probably go away by the time 2.2 ships.  In the meantime, it should
do the job it was designed to do, for the three highly vocal people who are
afraid of nested_scopes damage they won't actually suffer <0.9 wink>.

you've-seen-__future__-on-c.l.py-more-than-you'll-ever-see-it-in-
    real-life-ly y'rs  - tim





More information about the Python-list mailing list