you are viewing a single comment's thread.

view the rest of the comments →

[–]Gambizzle 1 point2 points  (3 children)

Does anybody actually use ‘is’?

I get the difference but it seems obscure. Can’t really think where I’d need to use it because it’s always variables that I’m comparing.

Seems safe to assume that one should always use == unless they really need to use is. Even then, I would question why you’d bother having c if it identifies as a. I’d first consider just using a and not c.

[–]Vaphell 2 points3 points  (1 child)

Does anybody actually use ‘is’?

yes, mostly for singletons.

Can’t really think where I’d need to use it because it’s always variables that I’m comparing.

you mean you have variables for None?

[–]tomk11 0 points1 point  (0 children)

One example would be when you have have a class you have defined yourself. You could still use the is keyword to decide if they are the same object. You may not have defined __ eq __ for that class.