Re: [Numpy-discussion] Assignment when there is nothing to assign

2006-12-21 Thread Keith Goodman
On 12/21/06, Keith Goodman <[EMAIL PROTECTED]> wrote: > I have the following two lines in a for loop: > > if len(idx): > x[idx,i] = x[idx,i-1] > > where idx is the output of a where statement. > > I need the 'if len(idx)' line to prevent an error when idx is empty. > > Would it make sense to al

[Numpy-discussion] Assignment when there is nothing to assign

2006-12-21 Thread Keith Goodman
I have the following two lines in a for loop: if len(idx): x[idx,i] = x[idx,i-1] where idx is the output of a where statement. I need the 'if len(idx)' line to prevent an error when idx is empty. Would it make sense to allow x[idx,i] = x[idx,i-1] when idx is empty instead of raising an er