python - Importing Modules vs. Executing Scripts for Global Variables -


is bad practice execute script execfile(xx.py), rather import xx module? reason i'm interested, executing file puts functions directly __main__, , globals available without needing explicitly pass them. but, i'm not sure if creates trouble... thanks!

yes, it's bad practice, reason ends in __main__. if have 2 modules have variable same name, 1 overwrite other.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -