does this code run rulekingthrillgore@lemmy.ml to 196@lemmy.blahaj.zone – 294 points – 11 months ago44Post a CommentPreviewYou are viewing a single commentView all commentsI mean this would remove False and None from a list though.Also 0 and empty stringsAnd empty lists, tuples, dictionaries, sets, and stringsresults = list(filter(None, results))results = [result for result in results if result != None]Should be is not None (:You're right, though IIRC there's no functional difference when comparing to None (other than speed).Yes there is. One invokes __ne__ on the left hand side, the other performs an identity comparison.
I mean this would remove False and None from a list though.Also 0 and empty stringsAnd empty lists, tuples, dictionaries, sets, and stringsresults = list(filter(None, results))results = [result for result in results if result != None]Should be is not None (:You're right, though IIRC there's no functional difference when comparing to None (other than speed).Yes there is. One invokes __ne__ on the left hand side, the other performs an identity comparison.
results = [result for result in results if result != None]Should be is not None (:You're right, though IIRC there's no functional difference when comparing to None (other than speed).Yes there is. One invokes __ne__ on the left hand side, the other performs an identity comparison.
Should be is not None (:You're right, though IIRC there's no functional difference when comparing to None (other than speed).Yes there is. One invokes __ne__ on the left hand side, the other performs an identity comparison.
You're right, though IIRC there's no functional difference when comparing to None (other than speed).Yes there is. One invokes __ne__ on the left hand side, the other performs an identity comparison.
I mean this would remove False and None from a list though.
Also 0 and empty strings
And empty lists, tuples, dictionaries, sets, and strings
results = list(filter(None, results))
results = [result for result in results if result != None]
Should be
is not None
(:You're right, though IIRC there's no functional difference when comparing to None (other than speed).
Yes there is. One invokes
__ne__
on the left hand side, the other performs an identity comparison.