Well yes, I don’t think naming is very accurate. If iterable has 2 elements, 
then it is `xor`, otherwise it is something else - it checks the number of 
truth values in iterable.

Short circuiting happens, when:
xor([True, True, False, False], n=1)
At index 1 it is clear that the answer is false.

Regards,
DG

> On 13 Nov 2023, at 19:42, Barry <ba...@barrys-emacs.org> wrote:
> 
> 
> 
>> On 13 Nov 2023, at 15:16, Dom Grigonis via Python-list 
>> <python-list@python.org> wrote:
>> 
>> I think it could be useful to have `xor` builtin, which has API similar to 
>> the one of `any` and `all`.
> 
> I do not understand how xor(iterator) works.
> I thought xor takes exactly 2 args.
> 
> I also do not understand how xor can be short circuited.
> For AND or OR only looking at the first arg works.
> But that does not work for xor right?
> 
> Barry
> 
> 

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to