[Python-Dev] Showstopper in import?

M.-A. Lemburg mal@lemburg.com
Fri, 02 Feb 2001 12:38:07 +0100


Tim Peters wrote:
> 
> > Percolator has "from x import *" code. This is what is causing the
> > exception.
> 
> Woo hoo!  The traceback bamboozled me:  it doesn't show any code from
> Percolator.py, just the import in EditorWindow.py.  So I'll call *that* the
> bug <0.7 wink>.
> 
> > I think it has already been fixed in CVS though, so should
> > work again.
> 
> Doesn't work for me.  If someone does patch Percolator.py, though, it will
> just blow up again at
> 
>     from IOBinding import IOBinding
> 
> .  Guido was apparently fond of this trick.

For completeness, here are all instance I've found in the standard
dist:

./Tools/pynche/pyColorChooser.py:
--             from Tkinter import *
./Tools/idle/IOBinding.py:
--     from Tkinter import *
./Tools/idle/Percolator.py:
--     from Tkinter import *

> > Even though I agree that "from x import *"
> > is bad style, it is quite common in testing code or code
> > which imports a set of symbols from generated modules or
> > modules containing only constants e.g. for protocols, error
> > codes, etc.
> 
> I know I'm being brief, but please don't take that as disagreement.  It's
> heading on 6 in the morning here and I've been plugging away at the release
> for a loooong time.  I'm not in favor of banning "from x import *" if
> there's an alternative.  But I don't grok the implementation issues in this
> area well enough right now to address it; I'm also hoping that Jeremy can,
> and much more quickly.
> 
> >>> Better issue a warning than raise an exception here !
> 
> >> If Jeremy can't generate correct code, a warning is too weak.
> 
> > So this is the price we pay for having nested scopes... :-(
> 
> I don't know.  It apparently is the state of the code at this instant.

Ok, Good Night then :-)

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/