From: Stefan v. d. W. <st...@su...> - 2006-10-19 00:55:30
|
A quick question on extending numpy arrays: is it possible to easily add an attribute to an ndarray? With Python-defined classes one can do class X(object): pass x =3D X() x.foo =3D 'bar' but with ndarrays you get x =3D N.array([1,2,3]) x.foo =3D 'bar' AttributeError: 'numpy.ndarray' object has no attribute 'foo' Is there an easy way around this (without writing a C extension)? Thanks for any advice. St=E9fan |