On 29 May 2012, at 15:00, Mark Bakker wrote:

> Why does isscalar('hello') return True?
> 
> I thought it would check for a number?

No, it checks for something that is of 'scalar type', which probably can be 
translated as 'not equivalent to an array'. Since strings can form numpy 
arrays, 
I guess the logic behind this is that the string is the atomic block of an 
array 
of dtype 'S' - for comparison, np.isscalar(['hello']) = False. 
I note the fine distinction between np.isscalar( ('hello') ) and np.isscalar( 
('hello'), )...

Cheers,
                                                Derek

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to