I have three modules as:
one.py
:
def abc():
print "Heeeeeeeeeeeiiiiiioooooooooo"
two.py
:
import one
def defg():
one.abc()
three.py
:
import os
from time import sleep
import two
two.defg()
sleep(20)
directory = os.listdir('.')
for filename in directory:
if filename[-3:] == 'pyc':
print '- ' + filename
os.remove(filename)
I have three doubts.
When I run three.py
for the first time one.pyc
and two.pyc
will be created. I can see it since I gave 20 sec delay. After executing the statement os.remove(filename)
, they get removed. Until here its fine.
Again without closing the IDLE as well as the script, I ran three.py
. This time no .pyc
file was created. Why is this so?
If I close IDLE as well as the script, .pyc
will be created as before.
Why the compiled code is not getting created again and again?
Also, if I make a change in
one.py
it will not be shown if I run without closing the shells. I need a solution for this also.Third doubt is if the compiled code is getting deleted first time itself, then how the second run gives the same result without
.pyc
?