dyoo(a)hkn.eecs.berkeley.edu writes:
>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
>###
>
>then the math module will magically turn on for all new interactive
>sessions. Pretty convenient! *grin* At least, this works from a regular
>interpreter window; I'm not quite so sure if this will work with all
>IDE's.
>
OK...I got my homework for the weekend: figure out how this is working.
It works like a charm! On the mac's IDE both the interactive console and
new scripts automatically can access math without an explicit import once
the lines suggested above have been put into the sitecustomize.py script.
Thanks, Danny.
Have a nice wekend.
/c