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

Guido van Rossum guido@digicool.com
Wed, 21 Feb 2001 20:42:11 -0500


> On Wed, Feb 21, 2001 at 09:56:40AM -0500, Jeremy Hylton wrote:
> 
> > 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 disagree. There are several ways to work around them, or the BDFL could
> just make a decision on what it should mean.

Since import * is already illegal according to the reference manual,
that's an easy call: I pronounce that it's illegal.  For b/w
compatibility we'll try to allow it in as many situations as possible
where it's not ambiguous.

> I don't *just* object to the backwards incompatibility, but also to the
> added complexity and the strange special cases, most of which were
> introduced (at my urging, I'll readily admit and for which I should and do
> appologize) to reduce the impact of the incompatibility. I do not believe
> the ability to leave out the default-argument-hack (if you don't use
> import-*/exec in the same function) is worth all that.

The strange special cases should not remain a permanent wart in the
language; rather, import * in functions should be considered
deprecated.  In 2.2 we should issue a warning for this in most cases.

(Is there as much as a hassle with exec?  IMO exec without an
in-clause should also be deprecated.)

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