Sebastian Haase wrote:
> Hi!
> I have a record array with a field 'mode'
> Mode is a small integer that I use to choose a "PixelType"
> So I did:
>   
>>>> print PixelTypes[ mode ]
>>>>         
> TypeError: tuple indices must be integers
>   
>>>> pdb.pm()
>>>>         
>> /home/haase/PrLinN64/Priithon/Mrc.py(813)MrcMode2numType()
>>     
> -> return PixelTypes[ mode ]
> (Pdb) p mode
> 1
> (Pdb) p type(mode)
> <type 'int32scalar'>
> (Pdb) p isinstance(mode, int)
> False
>
> Since numpy introduced special scalar types a simple statement like this 
> doesn't work anymore !  Would it work if int32scalar was derived from int ? I 
> actually thought it was ...
>   
It does sub-class from int unless you are on a system where a c-long is 
64-bit then int64scalar inherits from int.

On my 32-bit system:

isinstance(array([1,2,3])[0],int)  is true.



-Travis


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to