On Sun, Jul 29, 2001 at 01:00:59PM -0400, Guido van Rossum wrote:
(with future statement)
... from stat import * ... def eggs(): ... print x ... File "<stdin>", line 2 SyntaxError: import * is not allowed in function 'spam' because it contains a nested function with free variables
Hm. I'm curious why it was not made a warning without a nested function. Perhaps because too much 3rd party code would trigger the warning?
(I have a feeling that lots of amateur programmers are a lot fonder of import * than they should be :-( ).
Oh yeah. If ActiveState's mailinglist statistics were extended to show howmany of my posts preach against using 'import *', I'd be top dog in the python-list stats :-) I also still owe Fred a tutorial chapter on why not to use import * :)
... exec y ... def eggs(): ... print x
That one is just fine I think.
Why is 'import *' inside a function fine, but a bare exec isn't ? Weren't you going to deprecate bare exec's altogether ?