[Numpy-discussion] cos -- NameError: global name 'cos' is not defined

Wayne Watson sierra_mtnview@sbcglobal....
Mon Dec 21 18:51:54 CST 2009



josef.pktd@gmail.com wrote:
> On Mon, Dec 21, 2009 at 6:11 PM, Wayne Watson
> <sierra_mtnview@sbcglobal.net> wrote:
>   
...
>> )
>>    print np.sin(2.2)
>>
>> I've been assuming that IDLE clears the namespace.  It's quite possible
>> that I get anomalous results as I move between Run the program via the
>> editor, and fiddling in script land. I would like to think that IDLE has
>> some way to clear the namespace before it runs the program. If not, yikes!
>>     
>
> idle has two modes depending on whether it is started with or without
> -n option on the command line. I usually pick this option depending on
> what I am doing. From the IDLE help:
>
> Running without a subprocess:
>
> 	If IDLE is started with the -n command line switch it will run in a
> 	single process and will not create the subprocess which runs the RPC
> 	Python execution server.  This can be useful if Python cannot create
> 	the subprocess or the RPC socket interface on your platform.  However,
> 	in this mode user code is not isolated from IDLE itself.  Also, the
> 	environment is not restarted when Run/Run Module (F5) is selected.  If
> 	your code has been modified, you must reload() the affected modules and
> 	re-import any specific items (e.g. from foo import baz) if the changes
> 	are to take effect.  For these reasons, it is preferable to run IDLE
> 	with the default subprocess if at all possible.
>
> Josef
>
>   
I'm running under Win XP. If there are command line options, I'm not 
aware of them. I tried the reload in the script window, but got nowhere 
with it. Is it usable in the program itself? Ah, I'm looking in my copy 
of Core Python by Chun, and gives some details on it. The IDLE Help for 
itself does not mention reload(). Maybe I need to a Win command line get 
away from IDLE. I started into iPython, but slipped back to IDLE. I 
think it may need another chance.


More information about the NumPy-Discussion mailing list