On Mon, Jan 26, 2009 at 12:31 AM, Marc Tompkins <[email protected]> wrote:

> Someone will no doubt phrase this better, but let's take a shot...
>

> 2)  "import django" makes the entire django package and all sub-modules
> available.  You could then refer to django.forms.DecimalField and
> django.contrib.auth.ImproperlyConfigured (for example) in your program, no
> further imports needed.

No; in general,
  import x
does not make module x.y available for use, you have to explicitly
  import x.y

In [1]: import django

In [2]: django.forms
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/Users/kent/<ipython console> in <module>()
AttributeError: 'module' object has no attribute 'forms'

There are some exceptions that confuse the issue, for example you can
import os and then use os.path.whatever.

Other than that you are correct.

Kent
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to