[SciPy-dev] openopt example mmp_1.py

Stefan van der Walt stefan@sun.ac...
Mon Feb 4 14:34:52 CST 2008


On Mon, Feb 04, 2008 at 08:05:00AM -0500, Alan G Isaac wrote:
> > On Sun, Feb 03, 2008 at 11:39:02AM +0200, dmitrey wrote:
> >> "if type(ind) in [int, int32, int64]: return [ind]"
> 
> 
> On Mon, 4 Feb 2008, Stefan van der Walt apparently wrote:
> > 'issubdtype' does the checking you require:
> > import numpy as np 
> > np.issubdtype(ind,int)
> 
> 
> If one wanted to do such type checking,
> what would be the advantage in this case
> over isinstance(ind,int)?

Well, mainly this

In [1]: isinstance(np.int64,int)
Out[1]: False

In [2]: np.issubdtype(np.int64,int)
Out[2]: True

:)

Cheers
Stéfan


More information about the Scipy-dev mailing list