Other situations like this (was RE: [Python-Dev] Nested scopes resolution -- you can breathe again!)

Tim Peters tim.one@home.com
Sat, 24 Feb 2001 02:54:40 -0500


[Tim]
> ...
> A compile-time exception:  when you're asking for semantics the compiler
> can't give you, the presumption has to favor that you're in big trouble.
> You can't catch such an exception directly in the same module (because it
> occurs at compile time), but can catch it if you import the module from
> elsewhere.

Relatedly, you could do:

    try:
        compile("from __future__ import whatever", "", "exec")
    except whatever2:
        whatever3
    else:
        whatever4

Then the future_stmt's compile-time is your module's runtime.

still-looks-pretty-useless-to-me-though-ly y'rs  - tim