“Many” isn’t the same as “most,” though I don’t think there’s any way to know what “most” is.
But here’s my reason for agreeing w/ the OP:
not x checks both None and emptiness, which is usually desired
len(x) == 0 will raise an exception if x is null
with type hinting, those should be the only two reasonable options
It’s nice that it’s slightly faster, though performance has absolutely nothing to do w/ my preference, though it does have something to do with my preference for avoiding exceptions for non-exceptional cases.
“Many” isn’t the same as “most,” though I don’t think there’s any way to know what “most” is.
But here’s my reason for agreeing w/ the OP:
not x
checks bothNone
and emptiness, which is usually desiredlen(x) == 0
will raise an exception ifx
is nullIt’s nice that it’s slightly faster, though performance has absolutely nothing to do w/ my preference, though it does have something to do with my preference for avoiding exceptions for non-exceptional cases.