[Numpy-discussion] Use __slots__ with numarray?

Todd Miller jmiller at stsci.edu
Fri Nov 12 06:16:13 EST 2004


On Fri, 2004-11-12 at 04:27, Jens Jorgen Mortensen wrote:
> A few days ago, I found this page:
> 
> http://mail.python.org/pipermail/python-list/2004-May/220513.html
> 
> where speedups for creating objects using __slots__ is demonstrated.  I 
> have read somewhere that creation of numarrays is much slower than 
> creation of Numeric arrays - so maybe using __slots__ should be considered?
> 
> Just a suggestion from a happy numarray user!

Thanks for the suggestion!   I wondered about this before,  but the idea
fizzled through a combination of doubt about how much performance gain
would be involved and the impression that using __slots__ would preclude
creation of new attributes on basic NumArrays.  

Seeing real information about the performance motivates me to take a
closer look, so thanks.  I think placing the "no new attributes without
subclassing" restriction on NumArrays is probably worth the gains and
will check into it.

This day is getting better and better,
Todd







More information about the NumPy-Discussion mailing list