Fri, 29 Oct 2010 09:58:33 -0400, Ian Stokes-Rees wrote: [clip] > I've spent an hour looking at the numpy code (my first time), and I > don't see any obvious way to do this, since ndarray is (AFAICT) a pure-C > object with auto-generated wrappers, which seems to preclude (easily) > adding a "__getattr__(self,attr)" method to the class. If someone can > point me in the right direction, I'll keep looking into this, otherwise > I'm giving up and will just try and use recarray.
http://docs.python.org/c-api/typeobj.html#tp_getattro The Python documentation doesn't seem to say very if method/attribute slots are consulted before falling back to tp_getattro. If tp_getattro is consulted first, then implementing it will lead to a performance hit. I'd probably be +0 on providing recarray-like functionality on ordinary ndarrays, if it can be done without (significant) performance issues. -- Pauli Virtanen _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion