You're viewing a single thread.
View all comments
44
comments
I mean this would remove False and None from a list though.
59 0 ReplyAlso 0 and empty strings
38 0 ReplyAnd empty lists, tuples, dictionaries, sets, and strings
31 0 Replyresults = list(filter(None, results))
24 0 Replyresults = [result for result in results if result != None]
4 0 ReplyShould be
is not None
(:22 0 ReplyYou're right, though IIRC there's no functional difference when comparing to None (other than speed).
3 0 ReplyYes there is. One invokes
__ne__
on the left hand side, the other performs an identity comparison.9 0 Reply
You've viewed 44 comments.
Scroll to top