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 find I sometimes need it when dealing with pub-sub filters and multiple predicates in general.
What is the current situation that led me to writing this e-mail?
Dealing with circular import in low level component space: library builtins depend on validation utilities, while validation utilities want to use xor from library builtins.
Not a big issue, but seen there are fairly large threads in stack everyone inventing their own `xor`. And surprisingly there aren’t many good solutions. Almost none of them deal with short-circuiting well. And those that do contain loops that result in very poor performance.
Regards,
DG
--
https://mail.python.org/mailman/listinfo/python-list
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 find I sometimes need it when dealing with pub-sub filters and multiple predicates in general.
What is the current situation that led me to writing this e-mail?
Dealing with circular import in low level component space: library builtins depend on validation utilities, while validation utilities want to use xor from library builtins.
Not a big issue, but seen there are fairly large threads in stack everyone inventing their own `xor`. And surprisingly there aren’t many good solutions. Almost none of them deal with short-circuiting well. And those that do contain loops that result in very poor performance.
Regards,
DG
--
https://mail.python.org/mailman/listinfo/python-list