[Numpy-discussion] Is a string a scalar type?

Charles R Harris charlesr.harris at gmail.com
Sat Mar 24 21:23:48 EDT 2007


On 3/24/07, Robert Kern <robert.kern at gmail.com> wrote:
>
> Charles R Harris wrote:
> > In [10]: isscalar('hello world')
> > Out[10]: True
>
> I would say that, intrinsically, yes, strings are constructed as sequences
> of
> other things. However, essentially every use case I have for *testing*
> whether
> or not something is a sequence (or inversely, a scalar), I want strings to
> answer as "not a sequence".


I see

 'is_string_like',
 'iscomplex',
 'iscomplexobj',
 'isfinite',
 'isfortran',
 'ishold',
 'isinf',
 'isinteractive',
 'isnan',
 'isneginf',
 'isposinf',
 'ispower2',
 'isreal',
 'isrealobj',
 'isscalar',
 'issctype',
 'issubclass_',
 'issubdtype',
 'issubsctype',

But apparently none of them test for a scalar number. That is a strange
functionality to be missing.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070324/b7368581/attachment.html>


More information about the NumPy-Discussion mailing list