kingthrillgore to 196@lemmy.blahaj.zone • 1 year agodoes this code run rulelemmy.mlimagemessage-square44fedilinkarrow-up1295
arrow-up1295imagedoes this code run rulelemmy.mlkingthrillgore to 196@lemmy.blahaj.zone • 1 year agomessage-square44fedilink
minus-square@itslilith@lemmy.blahaj.zonelinkfedilink12•edit-21 year agoIt does! it takes a list (or other iterator) and filters out all values that are cast to boolean True. The same could be archived with results = list(filter(bool, results))
minus-square@kakes@sh.itjust.workslinkfedilink12•1 year agoIt would filter out values that cast to False, no?
minus-square@itslilith@lemmy.blahaj.zonelinkfedilink2•1 year agoi wasn’t sure how to phrase it, it keeps all values that cast to True, and discards all that cast to False
It does! it takes a list (or other iterator) and filters out all values that are cast to boolean True. The same could be archived with
results = list(filter(bool, results))
It would filter out values that cast to False, no?
Like None, 0, “”, …
i wasn’t sure how to phrase it, it keeps all values that cast to True, and discards all that cast to False