On Wed, Oct 13, 2021 at 12:05:35AM -0000, MarylandBall Productions wrote:
I would think `~string` could be good for a shorthand way to convert a string to an integer, considering you’re “inverting” the string to another type
How is `int(string, 16)` "inverting"? Inverting means to flip or reverse, not to convert to another type. Even if it did, why convert to an int, rather than a float, or a list, or bytes, or any other type? You could maybe make an argument for ~"Hello" to invert it by reversing horizontally "olleH" but even that would be pretty weak.
~string will be a confusing operation to many users.
I think it would be *all* users. I doubt that anyone could predict that the ~ operator converts to int using base 16 just by looking at the expression in isolation. -- Steve