[Python-Dev] Those import related syntax errors again...

Samuele Pedroni Samuele Pedroni <pedroni@inf.ethz.ch>
Wed, 21 Feb 2001 16:10:26 +0100 (MET)


This is becoming too much politics.

> 
> >>>>> "TW" == Thomas Wouters <thomas@xs4all.net> writes:
> 
>   TW> On Tue, Feb 20, 2001 at 10:29:36PM -0500, Andrew Kuchling wrote:
>   >> Let's not waffle.  If nested scopes are worth doing, they're
>   >> worth breaking code.
> 
>   TW> I'm sorry, but that's bull -- I mean, I disagree
>   TW> completely. Nested scopes *are* a nice feature, but if we can't
>   TW> do them without breaking code in weird ways, we shouldn't, or at
>   TW> least *not yet*. I am still uneasy by the restrictions seemingly
>   TW> created just to facilitate the implementation issues of nested
>   TW> scopes, but I could live with them if they had been generating
>   TW> warnings at least one release, preferably more.
> 
> A note of clarification seems important here:  The restrictions are
> not being introduced to simplify the implementation.  They're being
> introduced because there is no sensible meaning for code that uses
> import * and nested scopes with free variables.  There are two
> possible meanings, each plausible and neither satisfying.
> 
I think that

y=3
def f():
 exec "y=2"
 def g()
   return y
 return g()
 
with f() returning 2 would make sense (given python dynamic nature).
But it is not clear if we can reach consensus on the this or another
semantic. (Implementing this would be ugly, but this is not the point).

On the other hand just saying that new feature X make code Y (previously valid)
meaningless and so the unique solution is to discard Y as garbage,
is something that cannot be sold for cheap. I have the feeling that this
is the *point*.

regards, Samuele Pedroni.