On Monday, February 29, 2016 at 6:53:09 PM UTC+5:30, alien...@gmail.com wrote: > Hello Rustom, > > F5 in Idle restarts the Python interpreter (that's what my impression is). > Whatever you have done earlier at Idle prompt (in Idle session) before F5 is > gone after F5. > > Try simple experiment at prompt. > > >>> myvar="hello" > >>> myvar > 'hello' > > myvar is gone after F5. > > As for need of import in Idle session, I use it to > - import sys > - sys.append.path('D:\\Where\\Ever\\My\\Modules\\Lie') > - import mymodule
Why does one use (something like) idle? To experiment. So what's your experiment-focus? If it is mymodule then mymodule should be open in idle file window and idle will take care of paths If its someothermodule.py that has an import of mymodule.py then someothermodule should be handling the paths issue. In neither case I see a reason to do it at idle prompt [At least that's my understanding, hope an idle expert will weigh in on this] In linux this question does not typically arise as one starts idle from the shell in the same directory as the python files one wants to play with In windows... not sure of idiom... Maybe right-click the idle icon and change its 'start-in' to the path where your python files are situated? My general impression (best-practices not semantics) is that changing sys.path is allowed but hackish. 1. Modify sys.path 2. Using PYTHONPATH env variable 3. Use relative imports 4. Use packages ?. .pth files is roughly decreasing in hackishness though unfortunately increasing in sophistication http://stackoverflow.com/questions/19917492/how-to-use-pythonpath http://stackoverflow.com/questions/18521503/pydev-how-to-avoid-adding-sub-directories-to-python-path-in-order-to-fix-unres -- https://mail.python.org/mailman/listinfo/python-list