On Thu, 13 Jan 2005 13:20:11 +0100, Dimitri D'Or
<[EMAIL PROTECTED]> wrote:

> For some purpose, I would like to reinitialize the main namespace, i.e. I want
> to delete all the variables I have created through the use of functions or
> keyboard entries.

Hello Dimiti,

sound like you're talking about an interactive session. Otherwise
(within a script) it would be a really bad idea to try this (better
put your stuff into functions, that don't create global variables).

Even in an interactive session it sounds like a not that brilliant
idea, especially since I can't think of a way other than using exec
"del %s" % key for appropriate keys from globals(). Finding
"appropiate" keys is one tricky thing.

Why not end your ugly python session and start a new one? You can
define all your imports in the python startfile (on Linux, consult
python manpage. On Windows, I don't know). You can also define useful
functions or variables in your python startfile. This way, you're
really shure that all ugly variables are away without del'iting
anything important.

regards
Michael
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to