Interpolation between multiple modules of an application.
Gerrit Holl
gerrit.holl at pobox.com
Wed Dec 15 11:29:47 EST 1999
Fredrik Lundh wrote:
> yes, that's wrong. the "import" statement only reads
> the module and creates the class once -- the first time
> you import the module.
>
> see "What Does Python Do to Import a Module?" on
> http://www.pythonware.com/people/fredrik/fyi/fyi06.htm
> for more info (and the one exception to the above rule).
Thanks!
> > How do I share session-depentent objects between modules, without them all
> > doing the same over and over again?
>
> create them once, on the module level. that's all
> you need to do.
Thanks! I didn't know this construction works:
# a.py
a='this'
b='that'
# main.py
import a
a.a = 'not this, but another thing'
import b
# b.py
import a
print a.a # not what I exspected!
Thanks... didn't I search well or isn't this explained in the docs
as clear as Fredrik explains it in is FYI 6?
regards,
Gerrit.
--
"The IETF motto is 'rough consensus and running code'"
-- Scott Bradner (Open Sources, 1999 O'Reilly and Associates)
5:19pm up 3:15, 10 users, load average: 0.60, 0.25, 0.66
More information about the Python-list
mailing list