Question about import

Alex Martelli aleaxit at yahoo.com
Wed Aug 6 05:05:00 EDT 2003


On Wednesday 06 August 2003 02:18 am, Mark Daley wrote:
> The only exception I would consider to this would be Tkinter.  It seems
> like every last book on this always has the user import from Tkinter, not
> just import Tkinter itself.  Is this just by convention, or is there a
> perfectly good explanation for this?

I think it's mostly a convention.  In my Tkinter programs I use
    import Tkinter as Tk
or the like, and thus avoid e.g. accidents with the huge number of
constants such as DISABLED and the like which Tkinter exports.

But even in the Nutshell Tkinter examples I did use a few "from" 
(as well as mostly "import") statements, admittedly.


Alex






More information about the Python-list mailing list