From: Ed S. <sch...@ft...> - 2006-05-20 11:50:07
|
Hi all, I've discovered a bug in my SciPy code for sparse matrix slicing that was caused by the following behaviour of squeeze(): >>> a = array([3]) # array of shape (1,) >>> type(a.squeeze()) <type 'int32scalar'> That is, squeezing a 1-dim array returns an array scalar. Could we change this to return a 0-dim array instead? Another related question is this: >>> b = array(3) # 0-dim array >>> type(a.squeeze()) <type 'int32scalar'> I find this behaviour surprising too; the docstring claims that squeeze eliminates any length-1 dimensions, but a 0-dimensional array has shape (), without any length-1 dimensions. So shouldn't squeeze() leave 0-dimensional arrays alone? -- Ed |