persistant gloabl vars (very newbie) ?
Stef Mientki
S.Mientki-nospam at mailbox.kun.nl
Wed Dec 27 14:31:25 EST 2006
> other module that has done 'from init import *'.
>
> If you want that kind of behaviour it is better to use: 'import init' and
> refer to the variables as init.X and init.Y so that you can change them.
> Whether that is a good idea is another matter.
>
> There are other reasons for not using the from init import * form, as you
> might overwrite bindings in the module in an unforseen way. from init
> import X,Y explicitely is probably safer. And, by the way, from init import
> * can only be used at module level, not in inner namespaces.
thank you guys,
but it's still not quit handy
# initialization file (init1.py)
import time;
xx = 44
# main file was
print xx
x=time.time()
# main file should become
print init1.xx
x=init1.time.time()
so even for the "standard" functions like "time" I've to include the
preceeding module "init1" :-(
cheers,
Stef Mientki
More information about the Python-list
mailing list