|
From: Sasha <nd...@ma...> - 2006-01-22 00:57:21
|
On 1/21/06, Colin J. Williams <cj...@sy...> wrote: > ... > I much prefer the numarray treatment, particularly in a matrix context. > I suggest that, if it looks like an integer, b[1] should return a Python > scalar. In NumPy b[1] IS an integer: >>> from numpy import * >>> a =3D array([1,2,3]) >>> b =3D a[1] >>> isinstance(b, int) True It IS NOT rank-0 ndarray: >>> isinstance(b, ndarray) False Surely, the whole truth is that numpy scalars are instances of classes derived from Python scalars. What is the problem that numpy is causing you? If b was a python scalar, b.dtype would just raise an AttributeError. -- sasha |