import * considered harmful (was Re: circular imports (don't yell!))

Aahz aahzpy at panix.com
Sat Mar 23 02:24:22 EST 2002


In article <mailman.1016860656.32479.python-list at python.org>,
Sean 'Shaleh' Perry <shalehperry at attbi.com> wrote:
>
>in his defense, the gui libs often expect you have done a from X import *. 
>otherwise your commands are fiendishly long and ugly.
>
>win = gui.create_window(gui.top_level, gui.foo, gui.bar)

So do this instead:

    from X import create_window, top_level, foo, bar

Trust me, you really prefer this.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"We should forget about small efficiencies, about 97% of the time.
Premature optimization is the root of all evil."  --Knuth



More information about the Python-list mailing list