Importing and namespace visibility

bruno modulix onurb at xiludom.gro
Tue May 17 04:15:03 EDT 2005


jean-marc wrote:
> Merci Bruno, ( and also to Fredrik )
> 
> So I think I understand correctly, if I say that:
> each modulkes requires its own set of reference to whatever objects it
> needs to speak. The interpreter wil see not to create extra copies of
> the compiled code if many modules import the same modules but will make
> them all point to the one already existing (in this program's
> execution).

Seems right.

> Practically, it means every module import whatever it needs - be
> careful with recursive imports - keep things tidy by using the 'import
> suchModule' (and use dotted name chains to reach whatever is needed).

<hint>
There's a way to shortcut long.fully.dotted.Name without using the 'from
xxx import' syntax:

import long.fully.dotted
Name = long.fully.dotted.Name
</hint>

<OT>
> PS Nice weather in Bordeaux ? 

Well... varying, as usual !-)
</OT>


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list