• Artyom@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    15 days ago

    In my experience, if you didn’t write the function that creates the list, there’s a solid chance it could be None too, and if you try to check the length of None, you get an error. This is also why returning None when a function fails is bad practice IMO, but that doesn’t seem to stop my coworkers.

    • iAvicenna@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      15 days ago

      good point I try to initialize None collections to empty collections in the beginning but not always guaranteed and len would catch it