Re: when to use == and when to use is

2014-03-10 Thread Skip Montanaro
I agree with Ben. In this particular case, it seems you really should be using "==" unless obj_0, obj_1, and obj_2 are sentinels. Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: when to use == and when to use is

2014-03-10 Thread Ben Finney
George Trojan writes: > Both if statements work, of course. Which is more efficient? I don't know. The answer is likely to be dependent on many details of the code and the data. But I do know that the different operators communicate different intents. And that should be a primary reason for ch

Re: when to use == and when to use is

2014-03-10 Thread Ned Batchelder
On 3/10/14 2:09 PM, George Trojan wrote: I know this question has been answered: http://stackoverflow.com/questions/6570371/when-to-use-and-when-to-use-is , but I still have doubts. Consider the following code: class A: def __init__(self, a): self._a = a #def __eq__(self, othe