I was trying to disentangle some IDLE behavior today and discovered
that If the user has a .Idle.py file IDLE will run it when it starts
up. This is independent of running IDLESTARTUP or PYTHONSTARTUP when
the -s switch is given. It is run by Tk.readprofile as called from
Tk.__init__. The "Idle" comes from the name passed to TK() when
PyShell.py creates its Tk root. In fact, not only is it independent,
but it works differently: any imports done in .Idle.py go into Tk's
name space, whereas IDLESTARTUP/PYTHONSTARTUP is exec'd and imports
go into the interpreter's namespace.
I don't think this behavior is documented anywhere, although since I
had a .Idle.py file I must have seen something about this somewhere
at some point. It's very hard to search for ".Idle.py" when "idle.py"
is a file whose name appears frequently in discussions.
Is this something that I should submit as an Issue or is it widely
known behavior? It should at least be documented.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com