[Tutor] if statement problems(noob question)

Dave Angel davea at davea.name
Mon Apr 8 14:27:31 CEST 2013


On 04/08/2013 07:55 AM, Steven D'Aprano wrote:
> On 08/04/13 20:45, Dave Angel wrote:
>>
>> will always fail, since the integer 2 is not equal to the type int.
>> In Python 2.x, when you compare objects of different types, you
>> generally get unequal.  (Exception, if you define your own classes,
>> you can define how they compare to others)  In Python 3, you'd get an
>> exception.
>
>
> Not so. Equality testing is always allowed.
>

Right.  Thanks for the correction.  I should know better by now.

I knew I should have left that part off, since the OP is using version 2 
anyway.

-- 
DaveA


More information about the Tutor mailing list