Re: [Numpy-discussion] how to use the name of a ndarray as a string

2011-11-18 Thread Warren Weckesser
On Fri, Nov 18, 2011 at 10:40 AM, Chao YUE wrote: > Thanks to all people for this very nice discussions. > > the solutions are more that what I want!! and help me to clarify some > concepts, and really begin to use class as a beginner :) > FYI: Just a day or so ago, I stumbled across the same q

Re: [Numpy-discussion] how to use the name of a ndarray as a string

2011-11-18 Thread Chao YUE
Thanks to all people for this very nice discussions. the solutions are more that what I want!! and help me to clarify some concepts, and really begin to use class as a beginner :) I would say either Olivier or denis's solution can solve my problem completely. cheers, Chao 2011/11/18 denis >

Re: [Numpy-discussion] how to use the name of a ndarray as a string

2011-11-14 Thread Chris.Barker
On 11/10/11 3:57 AM, Olivier Delalleau wrote: > In such a situation you should probably use a dictionary from the start, all good suggestions, but while we're at it: On 11/10/11 2:17 AM, Chao YUE wrote: > Does anyone know how I can quickly use the name of a ndarray as a string? This reflects a k

Re: [Numpy-discussion] how to use the name of a ndarray as a string

2011-11-10 Thread Olivier Delalleau
In such a situation you should probably use a dictionary from the start, i.e.: d3['index'] = np.arange(100) then use d3['index'] everywhere instead of index. It can be more convenient (notation-wise) to use an object instead, i.e. either work within a class method (self.index = np.arange(100)),

[Numpy-discussion] how to use the name of a ndarray as a string

2011-11-10 Thread Chao YUE
Hi, Does anyone know how I can quickly use the name of a ndarray as a string? for example, I have In [54]: index=np.arange(100) then I want to use the name 'index' as a key in a new dictionary: d3=dict() d3['index']=index I can do it like the way above, but I have many ndarray variables that nee