[Python-ideas] Make "is" checks on non-singleton literals errors

Georg Brandl g.brandl at gmx.net
Wed Oct 10 16:21:52 CEST 2012


Am 09.10.2012 23:10, schrieb Serhiy Storchaka:
> On 09.10.12 23:15, Georg Brandl wrote:
>> The point is that in 99.9...% of cases,
>>
>>    if x == True:
>>
>> is just
>>
>>    if x:
> 
> Of cause. However in Lib/unittest/main.py I found a lot of "if x != 
> False:" which is not equivalent to just "if x:". It is equivalent to "if 
> x is None or x:" and so I left it as is.

Arguably, that should be "if x is not False", but it probably doesn't
matter too much.

Georg




More information about the Python-ideas mailing list