> +    # Test for ndarrays with no data.
> +    if (0,) in sizes.keys():
> +        raise ValueError('ndarray containing no items is present')

> This should not be an error, there should not be any problems with this
(and if, it should automatically result in a broadcasting error)


Hi Seberg,

Thanks for the suggestion. However, by the end of that sentence, you don't
seem convinced of what you're writing at the start? I will have a think
about your comment and get back to you later this week.

[personal observation: Over-reliance on generic broadcasting error messages
is one of the aspects of numpy I like least. If anything, the error message
could be expanded to explain what the user is doing wrong and why it
doesn't make sense, rather than removing the error and replacing it with
something more cryptic from a lower level function that has less
appreciation of the error's context.]


On Tue, Oct 1, 2013 at 11:24 PM, seberg <notifications@github.com> wrote:

> In numpy/lib/function_base.py:
>
> >          else:
> > -            S = S*ones(asarray(pfac).shape, S.dtype)
> > -    return choose(S, tuple(choicelist))
> > +            cond_sizes['scalar bool']=True
> > +
> > +    for i in range(0,len(choicelist)):
> > +        if type(choicelist[i]) is np.ndarray:
> > +            choice_sizes[choicelist[i].shape]=True
> > +
> > +    sizes=cond_sizes.copy()
> > +    sizes.update(choice_sizes)
> > +
> > +    # Test for ndarrays with no data.
> > +    if (0,) in sizes.keys():
> > +        raise ValueError('ndarray containing no items is present')
>
> This should not be an error, there should not be any problems with this
> (and if, it should automatically result in a broadcasting error)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/numpy/numpy/pull/3537/files#r6700157>
> .
>