Home

Reading through the Python tutorial, I got to section 6.4.1,
"Importing * From a Package", which states:

"If __all__ is not defined, the statement from Sound.Effects import *
does not import all submodules from the package Sound.Effects into the
current namespace; ..."

It then goes on to state:

"[It] imports whatever names are defined in the package [including]
any submodules of the package that were explicitly loaded by previous
import statements."

I am curious to learn the rationale for this behavior, since it just
caught me by surprise (hence the reason I was pouring over the
tutorial document in such detail :-))

Thus far, everything in Python has seemed very intuitive to me,
however the behavior of "from package import *" baffles me.

So I figured I'd ask -- why does Python behave this way.

(And now, I'm going to do some code cleanup :-))

--wpd

previous
next

Re: Trouble with CGI code from Code Example 7.3 of the "Python Interactive CGI Tutorial"
Re: permutations and combinations
Re: How to use std::cout to output a char as a number?
Re: Would Anonymous Functions Help in Learning Programming/Python?
Re: compilation error using ofstream
Fundacja Iskierka
Kidprotect
Fundacja Hobbit
Akogo
Pajacyk