On Tue, Jun 5, 2012 at 6:59 PM, Benjamin Root <ben.r...@ou.edu> wrote:

>
>
> On Tue, Jun 5, 2012 at 10:37 AM, Robert Kern <robert.k...@gmail.com>wrote:
>
>> On Tue, Jun 5, 2012 at 2:54 PM, Neal Becker <ndbeck...@gmail.com> wrote:
>> > I think it's unfortunate that functions like logical_or are limited to
>> binary.
>> >
>> > As a workaround, I've been using this:
>> >
>> > def apply_binary (func, *args):
>> >    if len (args) == 1:
>> >        return args[0]
>> >    elif len (args) == 2:
>> >        return func (*args)
>> >    else:
>> >        return func (
>> >            apply_binary (func, *args[:len(args)/2]),
>> >            apply_binary (func, *args[(len(args))/2:]))
>> >
>> > Then for example:
>> >
>> > punc2 = np.logical_and (u % 5 == 4,
>> >                       apply_binary (np.logical_or, u/5 == 3, u/5 == 8,
>> u/5 ==
>> > 13))
>>
>>
>> reduce(np.logical_and, args)
>>
>>
> I would love it if we could add something like that to the doc-string of
> those functions because I don't think it is immediately obvious.  How do we
> do that for ufuncs?
>

Edit numpy/core/code_generators/ufunc_docstrings.py

Ralf
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to