Python Performance: Why 'if not list' is 2x Faster Than Using len()

https://lemmy.world/post/28121911

Python Performance: Why 'if not list' is 2x Faster Than Using len() - Lemmy.World

Lemmy

How does Python know of itโ€™s my list or not?

if isinstance(mylist, list) and not mylist

Problem solved.

Or if not mylist # check if list is empty

I think you missed the joke ๐Ÿ˜…
I thought it was funny!