[SciPy-dev] openopt example mmp_1.py

Travis E. Oliphant oliphant@enthought....
Mon Feb 4 16:43:16 CST 2008


Alan G Isaac wrote:
> On Mon, 4 Feb 2008, Stefan van der Walt apparently wrote:
>   
>> In [1]: isinstance(np.int64,int)
>> Out[1]: False 
>>     
>
> Well that is not too surprising.  ;-)
>
>   
>>>> isinstance(N.int32,int)
>>>>         
> False
>
> But the following was surprising to me,
> which is surely what you meant to explain:
>
>   
>>>> isinstance(N.int32(0),int)
>>>>         
> True
>   
>>>> isinstance(N.int64(0),int)
>>>>         
> False
>
> So, why the difference here?
> Does it go away when Python's difference
> between int and long goes away?
>   

The technical problem here is that to sub-class built-in types (i.e. 
those created in an extension module) in Python there must be binary 
compatibility on the C-level.

So, int32 can have binary compatibility (on  32-bit system anyway), 
while int64 can't.     When int's and long's are united, some 
unspecified adjustment will have to be made.  In a sense, NumPy's 
int-type splitting is opposite in intent of Python's integer 
unification.   Handling this well will require some thought.

Best regards,

-Travis O.




> Thanks,
> Alan
>
>
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
>   



More information about the Scipy-dev mailing list