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

196

16514 readers
2235 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 1 year ago (1 children)

results = [result for result in results if result != None]

[–] [email protected] 22 points 1 year ago (1 children)
[–] [email protected] 3 points 1 year ago (1 children)

You're right, though IIRC there's no functional difference when comparing to None (other than speed).

[–] [email protected] 9 points 1 year ago

Yes there is. One invokes __ne__ on the left hand side, the other performs an identity comparison.