News for hackers. Stuff that matters.
Re:WTF Python: Exploring and understanding Python through su... by pansa2 on Thursday February 11, 2021 @03:56AM (#26099591)
I think the reason not to write `== None` is that classes can override `==`:

    class C:
        def __eq__(self, other): return True
    C() == None  # True
    C() is None  # False
Re:WTF Python: Exploring and understanding Python through su... by eirki on Thursday February 11, 2021 @06:13AM (#26100315)
It is also marginally faster, I think.
Re:WTF Python: Exploring and understanding Python through su... by dagw on Thursday February 11, 2021 @09:50AM (#26101992)
Just did a quick check, and looping over an array of 1 million Nones and checking each element

  el==None
was roughly 25% slower than

  el is None
edit: Doing

  None==el
was roughly 15% slower