[Numpy-discussion] please comment on scalar types

Sebastian Haase haase at msg.ucsf.edu
Mon Aug 14 21:02:21 EDT 2006


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 ...

Comments ?

- Sebastian Haase




More information about the NumPy-Discussion mailing list