nested scopes

Martin von Loewis loewis at informatik.hu-berlin.de
Fri Feb 2 17:14:04 EST 2001


Robin Becker <robin at jessikat.fsnet.co.uk> writes:

> Is it really true that J Hylton's nested scopes will cause code like
> 
> def bingo():
>   from string import *
>   ....
> 
> to be declared bad? 

That code has been bad for a long time. See

http://www.python.org/doc/current/ref/import.html

which says

# The from form with "*" may only occur in a module scope.

It is only now that this restriction is enforced by CPython; again,
the code was incorrect for a long time (see

http://www.python.org/doc/1.4/ref/ref6.html#REF17806

to get my point; it was also in the 1.1 version of the language
reference).

Regards,
Martin



More information about the Python-list mailing list