[Numpy-discussion] m-ary logical functions

Martin Luessi mluessi@gmail....
Thu Jul 12 12:26:25 CDT 2012


On Thu, Jul 12, 2012 at 10:53 AM, Neal Becker <ndbecker2@gmail.com> wrote:
> I've been bitten several times by this.
>
> logical_or (a, b, c)
>
> is silently accepted when I really meant
>
> logical_or (logical_or (a, b), c)
>
> because the logic functions are binary, where I expected them to be m-ary.
>
> Dunno if anything can be done about it.
>
> Sure would like it if they were m-ary and out was a kw arg.

I never had the problem that I tried to use or with more than two
arguments. But I agree, it's easy to make that mistake.

Instead of

logical_or (logical_or (a, b), c)

I usually use

any((a, b, c))


More information about the NumPy-Discussion mailing list