importing: what does "from" do?

Charles T. Smith cts.private.yahoo at gmail.com
Thu Jan 21 11:30:30 EST 2016


On Thu, 21 Jan 2016 08:59:39 -0700, Ian Kelly wrote:

> What happens if you just do 'import utilities'. Can you then call
> utilities.hexdump? Can you see anything in the utilities module?


Yes, that works!  That's what I'm doing as a work around.
I was trying to avoid doing that because I figured it would exponentiate
my circular dependency problems and in fact, that module has no place
in the module where I need hexdump.

The obvious suggestion is to put hexdump in a file by itself, but
that's not the point, now.  The point is, how to optimally manage
(existing) complex imports.


> Side observation: 'int' is a bad name for a package, because it will
> shadow the name of the 'int' built-in.


Boy oh boy have I experienced that now!  :)



More information about the Python-list mailing list