|
From: Travis O. <oli...@ie...> - 2006-02-24 05:07:18
|
Sasha wrote: >On 2/23/06, Francesc Altet <fa...@ca...> wrote: > > >>It's a bit late, but I want to support your proposal (most of it). >> >> > >You are not late -- you are the first to reply! When you say "most of >it," is there anything in particular that you don't like? > > Usually nobody has a strong opinion on these issues until they encounter something they don't like. I think many are still trying to understand what a rank-0 array is. >>>>type(array(2)*2) >>>> >>>> ><type 'int32scalar'> > >I believe it should result in a rank-0 array instead. > > Can you be more precise about when rank-0 array should be returned and when scalars should be? >I've recently wrote ndarray round function and that code illustrates >the problem of implicite scalar conversion: > > I think we will have issues no matter what because rank-0 arrays and scalars have always been with us. We just need to nail down some rules for when they will show up and live by them. Right now the rule is basically: rank-0 arrays become array-scalars all the time. The exceptions are rank0.copy() rank0.view() array(5) scalar.__array__() one_el.shape=() If you can come up with a clear set of rules for when rank-0 arrays should show up and when scalars should show up, then we will understand better what you want to do. -Travis |