kingthrillgore to [email protected] • 7 months agodoes this code run rulelemmy.mlimagemessage-square44fedilinkarrow-up1294arrow-down10
arrow-up1294arrow-down1imagedoes this code run rulelemmy.mlkingthrillgore to [email protected] • 7 months agomessage-square44fedilink
minus-square@[email protected]linkfedilink12•edit-27 months 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@[email protected]linkfedilink12•7 months agoIt would filter out values that cast to False, no?
minus-square@[email protected]linkfedilink2•7 months 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