On 2/29/2016 7:42 AM, Rustom Mody wrote:

Is import needed at all when trying out in Idle?
...
So it does appear that
1. import not necessary with(in) idle
2. However import and f5 (ie is run as main) are different

May some idle experts elaborate on this? Whats the idle idiom of import-ing?

Rustom, since I know that you are not a rank beginner, I have trouble understanding what you are asking. F5 when editing foo.py is equivalent to running "python -i foo.py" on a command line while 'in' the directory containing foo.py. In both cases, foo.py is run as a main module, with __name__ == '__main__'. The difference is that F5 runs foo.py under IDLE supervision, with results going into and interactive inputs coming from IDLE shell instead of the console interpreter.

Imports are used in a module to access objects within the imported module.

--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to