[SciPy-user] Subclassing array
Albert Strasheim
fullung at gmail.com
Thu Oct 26 03:50:24 EDT 2006
Hey Michael
Don't record arrays already solve your problem? See the following page on
the wiki for some examples:
http://www.scipy.org/RecordArrays
Cheers,
Albert
> -----Original Message-----
> From: scipy-user-bounces at scipy.org [mailto:scipy-user-bounces at scipy.org]
> On Behalf Of Michael McNeil Forbes
> Sent: 25 October 2006 02:44
> To: scipy-user at scipy.org
> Subject: [SciPy-user] Subclassing array
>
> I have a question about the best way to subclass array types.
>
> I would like to create a subclass of the array types that allows me to
> name the entries of the array. Here is a sample of my desired usage:
>
> >>> from scipy import *
> >>> a = array([1.0,2.0])
> >>>
> >>> class MyArray(a.__class__):
> >>> _names = ['x','y']
> >>> ... (redefine __get__ etc. as needed)
> >>>
> >>> c = MyArray(x=2,y=3)
> >>> c.x, c.y
> (2, 3)
More information about the SciPy-User
mailing list