Open jayvdb opened 3 years ago
https://github.com/golang/go/issues/9367 is related. We could be using:
assert((std::vector<std::string>{std::string{"false"},
std::string{"true"}})[int(true)] ==
std::string{"true"});
works for cpp. Two fixes needed:
[a, b](bool)
is a fairly common trick employed in Python, leveraging of the fact thatFalse == 0
andTrue == 1
It works correctly in Rust and Julia (and C++ except for https://github.com/adsharma/py2many/issues/127), but not in Go, Kotlin and Nim.
Additionally,
True > 0
&True == 0
fails except C++, Julia and Rust due to operator>
not supporting bool, and the same forTrue == 1
and other comparison operators.