From: Pearu P. <pe...@ce...> - 2002-09-16 23:09:26
|
On Mon, 16 Sep 2002, Travis Oliphant wrote: > > Frankly, I have no idea what the implimentation details would be, but > > could we get rid of rank-0 arrays altogether? I have always simply found > > them strange and confusing... What are they really neccesary for > > (besides holding scalar values of different precision that standard > > Pyton scalars)? > > With new coercion rules this becomes a possibility. Arguments against it > are that special rank-0 arrays behave as more consistent numbers with the > rest of Numeric than Python scalars. In other words they have a length > and a shape and one can right N-dimensional code that works the same even > when the result is a scalar. In addition, rank-0 arrays are mutable while Python scalars are not. Mutability is sometimes useful (e.g. when emulating C or Fortran calls in Python) but often also evil due to its unpythonic side effect. Pearu |