xor operator

Grant Edwards grant.b.edwards at gmail.com
Mon Nov 13 17:51:05 EST 2023


On 2023-11-13, Dom Grigonis via Python-list <python-list at python.org> wrote:
> Hi All,
>
> I think it could be useful to have `xor` builtin, which has API similar to the one of `any` and `all`.
>
> * Also, it could have optional second argument `n=1`, which
> * indicates how many positives indicates `True` return.  For
> * complete flexibility 3rd argument could indicate if `the number`
> * is equal, greater, less, ... than `n`

I would expect "xor" to return true if there are an odd number of
trues, and false if there are an even number of trues.  It's not clear
to me what you're asking for.





More information about the Python-list mailing list