Okay so in Python the PEP8 standard promotes checking for an empty string like the following:
string = ""
not string (which evaluates to True)
But what if I want to check whether a string has content?
string = "hi"
not not string
@arkedos I suppose this is a joke, but if you actually want to convert a string to its raw boolean, you can use `bool(string)`.
In most cases, you don't need to do that because it's done implicitly, e.g.
if string:
...
@arkedos Yeah, I wasn't sure mainly becuase that's actually a fairly common idiom for converting to bool in some languages, actually. I've definitely seen !!x around in C and C++.
According to this random blog post, it shows up more than 5000 times in the Linux kernel: https://dev-notes.eu/2019/10/Double-Negation-Operator-Convert-to-Boolean-in-C/