ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> numpy-discussion
numpy-discussion
Re: [Numpy-discussion] can't resize ndarray subclass
by Zachary Pincus other posts by this author
Feb 28 2006 1:58PM messages near this date
Re: [Numpy-discussion] can't resize ndarray subclass | Re: [Numpy-discussion] can't resize ndarray subclass
Thanks Travis for the replies and the new functionality in the SVN!

I think I have enough (well, maybe once I figure out  
__array_priority__) to get a decent wiki entry for subclassing  
ndarray, and maybe some template subclasses that others can use.

I presume __array_priority__ determines the resulting type when two  
different type arrays are ufunc'd together? The exact mechanism of  
which object gets selected as the parent, etc., is still unclear though.

Zach


On Feb 28, 2006, at 1:24 PM, Travis Oliphant wrote:

>  Zachary Pincus wrote:
> 
> > However a new problem has me nearly tearing my hair out. Calling  
> > the  resize method on an instance of such a subclass works fine.  
> > However,  calling a method that calls 'self.resize' breaks! And  
> > worse, it  breaks in such a way that then subsequent calls to  
> > resize also break.
> 
> 
>  In SVN version of numpy, there is a new keyword argument to resize  
>  (refcheck).  If this keyword argument is 0 (it defaults to 1), the  
>  reference-count check is not performed.  Thus, if you are sure that  
>  your array has not exposed it's memory to another object, then you  
>  can set refcheck=0 and the resize will proceed.
> 
>  If you really did expose your memory to another object, this could  
>  lead to segfaults in exactly the same way that exposing the memory  
>  to a Python array (array module) and then later resizing (which  
>  Python currently allows) would cause problems.
> 
>  Be careful...
> 
>  -Travis
> 
> 
> 
> 
> 
>  -------------------------------------------------------
>  This SF.Net email is sponsored by xPML, a groundbreaking scripting  
>  language
>  that extends applications into web and mobile media. Attend the  
>  live webcast
>  and join the prime developer group breaking into this new coding  
>  territory!
>  http://sel.as-us.falkag.net/sel? 
>  cmd=lnk&kid=110944&bid=241720&dat=121642
>  _______________________________________________
>  Numpy-discussion mailing list
>  Numpy-discussion@[...].net
>  https://lists.sourceforge.net/lists/listinfo/numpy-discussion



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@[...].net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Thread:
Zachary Pincus
Travis Oliphant
Zachary Pincus
Travis Oliphant
Tim Hochberg
Travis Oliphant
Zachary Pincus
Travis Oliphant
Travis Oliphant

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved