Re: using import * with GUIs?
- From: Mel Wilson <mwilson-to@xxxxxxxxxxxx>
- Date: Wed, 31 May 2006 16:57:47 -0400
John Salerno wrote:
Hi all. Quick question (but aren't they all?) :)More specific? I dunno, I have trouble thinking of that
Do you think it's a good idea to use the 'from <name> import *' statement when using a GUI module? It seems on wxPython's site, they recommend using import wx nowadays, but I wonder if that advice is followed. Also, I'm still reading some Tkinter docs that seem to use 'from Tkinter import *' a lot.
I understand the danger of doing this, but is it safer in these cases, given the more specific names that GUI frameworks tend to use (sometimes!)? Or should you still qualify all your calls with the module?
huge multitude of names in wx as specific. Who knows what
in all that might collide with names you devise?
My formative experience came when I was looking at Python
Imaging Library Demo code. Somebody did a simple call to
open and got returned an entire Jpeg image object. I knew
that open was destined to take arguments other than simple
file paths, and return things other than simple files, but
it seemed awfully soon. Then I got suspicious, looked at
the top of the code, and saw "from Image import *"
So a word, too, to people writing demo programs. Writing
"from mycode import *" obscures which code is actually yours
in the code following. Kind of defeats the purpose.
Cheers, Mel.
.
- References:
- using import * with GUIs?
- From: John Salerno
- using import * with GUIs?
- Prev by Date: OT: Search for python in Norway
- Next by Date: Re: shuffling elements of a list
- Previous by thread: Re: using import * with GUIs?
- Next by thread: OT: Search for python in Norway
- Index(es):