Proposal: === and !=== operators
Ethan Furman
ethan at stoneleaf.us
Sat Jul 12 02:53:49 EDT 2014
On 07/11/2014 11:39 PM, Chris Angelico wrote:
> On Sat, Jul 12, 2014 at 4:11 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
>> class list:
>> def __eq__(self, other):
>> if len(self) != len(other):
>> return False
>> for this, that in zip(self, other):
>> if this is that or this == that:
>> continue
>> break
>> else:
>> return True
>> return False
>
> Seems a little elaborate. Why not just return straight from the loop,
> instead of breaking and using else? :)
Because I'm tired, and it seemed like a good excuse to show else with for, and because I'm tired. :)
--
~Ethan~
More information about the Python-list
mailing list