• JasonDJ@lemmy.zip
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 个月前

    Doesn’t Python treat all empty iterables as false tho? This isn’t unique to python, is it? (though I’m not a programmer…just a dude who writes scripts every now and then)

    • gravitas_deficiency@sh.itjust.works
      cake
      link
      fedilink
      English
      arrow-up
      3
      ·
      2 个月前

      My point is that the second statement you presented can have the effect of evaluating emptiness of a Sequence (note: distinct from an Iterable), but that only holds true if the target of the conditional IS a sequence. I’m underlining the semantic difference that was elided as a result of falsey evaluation.