New PEP: The directive statement

Bruce Sass bsass at freenet.edmonton.ab.ca
Thu Mar 22 09:53:20 CET 2001


On Wed, 21 Mar 2001, Neil Schemenauer wrote:

> On Wed, Mar 21, 2001 at 10:21:50PM -0700, Bruce Sass wrote:
> > Why was (something along the lines of)...
> ...
> > use:
> >     __future__.nested_scopes
> >     # code that relies on nested scopes
> > except FutureError:
> >     # code that does not use nested scopes
> >
> > ...rejected?  [It looks like a natural to me <shrug>...
>
> "from __future__ import x" is a compile time switch.

Sorry, careless example.
"use:" would be a compile time switch (it would have to be),...

use:
    __future__.nested_scopes

...would be the same as...

from __future__ import nested_scopes


use:
    from __future__ import nested_scopes

...would have conveyed some of what I was after, but is overly
verbose.

The use/except construct may only make sense to a different
(hmmm) "class" of beta feature, or if you allow the user to override
the use of experimental code (in which case the programmer could
provide an alternative, if they are thoughtful).

> May I
> suggest reading the PEP:
<...>

Thanks for the URL... didn't help.  From what I read... what I'm
thinking of would probably be considered beyond the scope of the PEP;
the try/except Q: is kinda what I'm thinking of, my counter-question
would be:  So why not implement a similar mechanism at the compile
level (let's call it "use:")?

IMHO,
the PEP you referred to could be for the case where
"use: __future__.feature" has been used, there could be PEPs for
"use: __transitional__.whatever", etc.


- Bruce





More information about the Python-list mailing list