293
you are viewing a single comment's thread
view the rest of the comments
[-] itslilith@lemmy.blahaj.zone 12 points 1 year ago* (last edited 1 year ago)

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))
[-] kakes@sh.itjust.works 12 points 1 year ago

It would filter out values that cast to False, no?

[-] lugal@sopuli.xyz 4 points 1 year ago

Like None, 0, "", ...

[-] itslilith@lemmy.blahaj.zone 2 points 1 year ago

i wasn't sure how to phrase it, it keeps all values that cast to True, and discards all that cast to False

this post was submitted on 22 Nov 2023
293 points (100.0% liked)

196

16501 readers
2229 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS