Re: importing part of a module without executing the rest

2008-06-13 Thread Ben Finney
[EMAIL PROTECTED] writes: > file1.py > -- > a = 20 > from abc import * > print "Should this be printed when 'a' is alone imported from this > module" > > file2.py > -- > from file1 import a > print a > > file2.py is used in a context where 'from abc import *' statement > doesn't

Re: importing part of a module without executing the rest

2008-06-13 Thread George Sakkis
On Jun 13, 5:52 pm, [EMAIL PROTECTED] wrote: > file1.py > -- > a = 20 > from abc import * > print "Should this be printed when 'a' is alone imported from this > module" > > file2.py > -- > from file1 import a > print a > > (snipped) > > Of course, the option of using if __name__ ==