News for hackers. Stuff that matters.
Re:Google Python Style Guide by hermitdev on Sunday February 12, 2023 @01:50AM (#34760549)
One thing I haven't seen anyone else mention besides not being idiomatic Python is that ”if users == []" and it's ilk allocate a new empty object for the comparison. It's unnecessarily slow and wasteful.

Others have mentioned that the comparison to say a tuple will also fail. If the intent is to ensure a list instance, use isinstance, instead.

There are no comments on this comment yet.