• Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 months ago

    No, I want that in the std lib. Yes, it would just call x % 2 == 0 underneath. But the advantage is readability. I’m in principle aware that x % 2 == 0 is true when the number is even, but I need it seldomly enough that I do still need to think about it for a second before I know for sure. I don’t need to think about x.is_even(). And the readability is what I want natively, i.e. in the std lib.

    It being in the std lib would also sidestep your concerns about security or the function call having unknown side effects.