New PEP: The directive statement

Fredrik Lundh fredrik at
Wed Mar 21 16:29:38 CET 2001

Piet van Oostrum wrote:
> FL> import declares things, in all existing Python versions (hint: it's
> FL> an assignment statement)
> On the other hand, the effect of import is the same as the calling of the
> magical __import__ function, of which the definition says:
> This function is invoked by the import statement (not declaration).
> And it is done at runtime, not compiletime.

Yup, but import has compile-time behaviour too, like any
other assignment operator.

(and vice versa, the "from __future__" statement has run-
time behaviour as well...)

But this doesn't matter much; the from __future__ statement is
a hack designed to deal with a another hack (all the code jeremy
had to add to dumb down his new compiler).  All last-minute
attempts to replace that with something that appears to be
more future proof (but really isn't) falls under the good old X
windows adage:

    "the only thing worse than generalizing from one example is
    generalizing from no example at all"

Cheers /F

More information about the Python-list mailing list