[Tutor] question about import statement
Hugo Arts
hugo.yoshi at gmail.com
Fri Aug 27 04:29:06 CEST 2010
On Thu, Aug 26, 2010 at 9:16 PM, Bill Allen <wallenpb at gmail.com> wrote:
>
> I did try that and of course it gave an error because it was necessary. I
> just did not know why. However, I later found an explanation on the web.
> Here it is:
>
> from tkinter import *
> from tkinter import ttk
>
> These two lines tell Python that our program needs two modules. The first,
> "tkinter", is the standard binding to Tk, which when loaded also causes the
> existing Tk library on your system to be loaded. The second, "ttk", is
> Python's binding to the newer "themed widgets" that were added to Tk in 8.5.
>
yeah, "from package import *" doesn't actually import every name from
a module. For example, by default, names starting with an underscore
are not imported. Alternatively, if you have a variable named __all__
in your module, and it's a list of names, only those names in the list
actually get imported when you do a "from x import *"
Hugo
More information about the Tutor
mailing list