Clearing memory (namespace) before running code

Jon Clements joncle at
Sun Mar 21 16:18:01 CET 2010

On 21 Mar, 15:02, vsoler < at> wrote:
> Hi,
> Is there a way to erase/delete/clear memory before a piece of code is
> run?
> Otherwise, the objects of the previous run are re-usable, and may
> bring confusion to the tester.
> Thank you

I'm guessing you're using some sort of IDE?

For instance, in IDLE if the [Python Shell] window is not closed, the
session is kept. However, there is a menu option 'Shell' which has
'Restart Shell'. If you don't see a 'Shell' menu option, then make
sure IDLE isn't being started with the -n option.

However I would have thought the 'tester' would be running from a
terminal/command line/double click jobby, so that a single Python
session is executed and just runs -- rather than want to use it
interactively afterwards.



More information about the Python-list mailing list