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

Tim Peters tim.one@home.com
Fri, 23 Feb 2001 17:56:39 -0500


[Jeremy]
> 1 Should this work?
>
> if x:
>     from __future__ import nested_scopes
>
> I presume not, but the sketch of the rules you posted earlier
> presumably allow it.

You have to learn to think more like tabnanny:  "module scope" obviously
means "indent level 0" if you're obsessed with whitespace <wink>.

> 2. How should the interactive interpreter be handled?

You're kidding.  I thought we agreed to drop the interactive interpreter for
2.1?  (Let's *really* give 'em something to carp about ...)

> I presume if you type
> >>> from __future__ import nested_scopes
>
> That everything thereafter will be compiled with nested scopes.

That's my guess too, of course.

> This ends up being a little tricky, because the interpreter has to
> hang onto this information and tell the compiler about it.

Ditto for

python -i some_script.py

where some_script.py contains a magical import.  OTOH, does exec-compiled
(or execfile-ed) code start with a clean slate, or inherent the setting of
the module from which it's exec[file]'ed?  I think the latter has to be
true.

Could get messy, so it's a good thing we've got several whole days to work
out the kinks ...

business-as-usual-ly y'rs  - tim