> +    # If condlist/choicelist are empty, return the default value immediately.
> +    if len(condlist)==0:
> +        return np.array([])
> +


This catches a case that was mis-handled by the old implementation; it
returned a shape/value that was not specified in choicelist or
default, breaking from the spec.



On Tue, Oct 1, 2013 at 11:09 PM, seberg <notifications@github.com> wrote:

> In numpy/lib/function_base.py:
>
> > +
> > +    # Clone the input lists to prevent side effects to the parameter lists:
> > +    condlist = list(condlist)
> > +    choicelist = list(choicelist)
> > +
> > +    # Check that the inputs are acceptable.
> > +
> > +    # Check the size of condlist and choicelist are the same, or abort.
> > +    if len(condlist) != len(choicelist):
> > +        raise ValueError('list of cases must be same length as list of conditions')
> > +
> > +    # If condlist/choicelist are empty, return the default value immediately.
> > +    if len(condlist)==0:
> > +        return np.array([])
> > +
> > +    # If cond array is not an ndarray in boolean format or scalar bool, abort.
>
> OK, maybe note that the whole code block can be removed after deprecation.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/numpy/numpy/pull/3537/files#r6699732>
> .
>