Re: [Numpy-discussion] silly isscalar question

2012-05-29 Thread Derek Homeier
On 29 May 2012, at 15:42, Nathaniel Smith wrote: >> I note the fine distinction between np.isscalar( ('hello') ) and >> np.isscalar( ('hello'), )... > > NB you mean np.isscalar( ('hello',) ), which creates a single-element > tuple. A trailing comma attached to a value in Python normally creates

Re: [Numpy-discussion] silly isscalar question

2012-05-29 Thread Nathaniel Smith
On Tue, May 29, 2012 at 2:31 PM, Derek Homeier wrote: > 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 equiva

Re: [Numpy-discussion] silly isscalar question

2012-05-29 Thread Derek Homeier
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 gues

Re: [Numpy-discussion] silly isscalar question

2012-05-29 Thread Nathaniel Smith
On Tue, May 29, 2012 at 2:00 PM, Mark Bakker wrote: > Why does isscalar('hello') return True? > > I thought it would check for a number? > > Numpy 1.6.1 > > Silly question? Nope, but you're thinking of a different sense of "scalar" :-). In numpy, "scalar" means something like "anything that you

[Numpy-discussion] silly isscalar question

2012-05-29 Thread Mark Bakker
Why does isscalar('hello') return True? I thought it would check for a number? Numpy 1.6.1 Silly question? ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion