[Pythonmac-SIG] Re: [Tutor] sitecustomize and pythonstartup

Jack Jansen Jack.Jansen@oratrix.nl
Sat, 2 Feb 2002 00:18:11 +0100


On Friday, February 1, 2002, at 11:41  PM, Danny Yoo wrote:

> On Fri, 1 Feb 2002, Christopher Smith wrote:
>
>> OK, the question is this.  The interpreter can be educated as to what
>> modules are loaded (i.e. if pythonstartup imports math, you can type
>> math.pi in the interpreter and be understood).  Is there a way to get
>> this to happen in the IDE's interpreter as well?  If sitecustomize.py
>> imports math I can't seem to access that at the >>> prompt.
>
> Yes, it's possible.  If we add the following fragment to our
> sitecustomize.py:
>
> ###
> import math
> import __builtin__
> __builtin__.math = math
> del math
> ###

But this will not only make it show up in interactive 
interpreters, it will also make it show up globally, in every 
module. I'm not sure this is a good idea...
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- 
Emma Goldman -