[Numpy-discussion] float32 is not a float ?
Thu Apr 10 14:22:48 CDT 2008
isinstance() can take a tuple of classes/types as its second argument:
In : isinstance?
Base Class: <type 'builtin_function_or_method'>
String Form: <built-in function isinstance>
Namespace: Python builtin
isinstance(object, class-or-type-or-tuple) -> bool
Return whether an object is an instance of a class or of a
With a type as second argument, return whether that is the
The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut
isinstance(x, A) or isinstance(x, B) or ... (etc.).
On Apr 10, 2008, at 12:38 PM, Charles Doutriaux wrote:
> I guess this maybe "normal" but it breaks a lot of thing when
> from Numeric
> float64 works...
> I can see why one could argue for returning False, but then the
> converter might be too zealous
> things that used to work like:
> if type(item) in [types.IntType, types.FloatType]:
> isinstance(item, types.FloatType)
> now fail,
> should we be concerned? should we consider returning True ?
** Bill Spotz **
** Sandia National Laboratories Voice: (505)845-0170 **
** P.O. Box 5800 Fax: (505)284-0154 **
** Albuquerque, NM 87185-0370 Email: email@example.com **
More information about the Numpy-discussion