[Idle-dev] Definitions in a script for the IDLE shell

Terry Reedy tjreedy at udel.edu
Sat Jan 28 06:17:50 CET 2012


On 1/20/2012 3:04 PM, Dmitry Popov wrote:

> If I run a script or a module as the main script using command Run
> Module (or F5) it looks like all the definitions of this script
> (variables, functions…) are available in the interactive interpreter
> which is active after the main script is executed. The problem is that I
> could not find any documentation where this is stated directly. Does
> anybody know clear confirmation that this is correct?

Idle is a bit underdocumented.

> In other words the question is whether IDLE command Run Module (or F5)
> is equivalent to start of Python from command line using the following
> command: python –i filename.py?

Right, with the different that output from previous sessions is still 
available in the window.

> This is important for me because I’m going to use many different
> starting definitions to work in the IDLE interactive interpreter.

The current behavior is not going to change. For me, this is a feature 
because I can interactively print values and call functions if there is 
a bug in my program. It can also be used to setup an interactive 
environment, which is what you seem to want to do.

-- 
Terry Jan Reedy




More information about the IDLE-dev mailing list