On Tue, Mar 19, 2019 at 11:32:56AM +1300, Greg Ewing wrote: > Tim Delaney wrote: > >I would argue the opposite - the use of "is" shows a clear knowledge > >that True and False are each a singleton and the author explicitly > >intended to use them that way. > > I don't think you can infer that. It could equally well be someone who's > *not* familiar with Python truth rules and really just meant "if x". > Or someone who's unfamiliar with booleans in general and thinks that > every "if" statement has to have a comparison in it.
This! Writing "if some_bool = true" in static typed languages is pretty common. I used to see it a lot in my Pascal days. In fairness that was because I used to write some of it myself :-( For some reason it rarely seems to happen when the flag being tested is itself a boolean expression: if x > 0: # this if (x > 0) is True: # but never this which gives credence to your idea that people expect that people are (consciously or unconsciously) expecting every if to include a comparison. -- Steven _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/