Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: Correct IDLE usage (was Reason for not allowing import twice but allowing reload()) Date: Tue, 1 Mar 2016 01:52:24 -0500 Lines: 24 Message-ID: References: <645cdd46-d4a4-49b3-a0d8-848608d70d73@googlegroups.com> <075122af-1a9c-44b6-97bb-521ebcb3e4ae@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de TRVVwECTrIaUmhgVfU8RzQIFxFlQ5rAimn8CDbasXvcA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:IDLE': 0.04; '__name__': 0.07; 'interpreter.': 0.07; 'imported': 0.09; 'imports': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.11; 'subject:not': 0.11; 'subject: \n ': 0.15; '"python': 0.16; 'inputs': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'subject:import': 0.16; 'subject:usage': 0.16; 'wrote:': 0.16; 'module,': 0.18; 'shell': 0.18; 'runs': 0.18; 'trying': 0.22; 'am,': 0.23; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'appear': 0.26; 'command': 0.26; 'header:X-Complaints-To:1': 0.26; 'equivalent': 0.27; 'module.': 0.27; 'objects': 0.29; 'run': 0.33; 'idle': 0.33; 'this?': 0.34; 'running': 0.34; 'trouble': 0.35; 'instead': 0.36; 'needed': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'difference': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'skip:u 10': 0.61; 'received:96': 0.63; 'different': 0.63; 'within': 0.64; 'results': 0.66; 'experts': 0.70; '(ie': 0.84; 'idiom': 0.84; 'received:fios.verizon.net': 0.91; 'rank': 0.97 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: pool-96-227-207-81.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: <075122af-1a9c-44b6-97bb-521ebcb3e4ae@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103778 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