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

Guido van Rossum guido@digicool.com
Tue, 20 Feb 2001 17:54:54 -0500


> > Does the function that contains the exec also contain another function
> > or lambda?  If it does and the contained function has references to
> > non-local variables, the compiler will complain.
> 
> It appears this is the problem.  The fact that only "__init__.py" was listed
> threw me - I have a few of them :)
> 
> *sigh* - this is a real shame.  IMO, we can't continue to break existing
> code, even if it is good for me!  People are going to get mighty annoyed - I
> am.  And if people on python-dev struggle with some of the new errors, the
> poor normal users are going to feel even more alienated.

Sigh indeed.  We could narrow it down to only raise the error if there
are nested functions or lambdas that don't reference free variables,
but unfortunately most of them will reference at least some builtin
e.g. str()...

How about the old fallback to using straight dict lookups when this
combination of features is detected?

--Guido van Rossum (home page: http://www.python.org/~guido/)