On 2017-07-07, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > Sayth Renshaw <flebber.c...@gmail.com> writes: >>I have tried or conditions of v == False etc but then the 0's >>being false also aren't moved. How can you check this at >>once? > > »The Boolean type is a subtype of the integer type, and > Boolean values behave like the values 0 and 1, > respectively, in almost all contexts, the exception > being that when converted to a string, the strings > "False" or "True" are returned, respectively.« > > The Python Language Reference, Release 3.6.0; > 3.2 The standard type hierarchy > > So maybe you can add a test for the type? > >>>> def isfalse( x ): > ... return x == 0 and str( type( x )) == "<class 'bool'>" > ...
What's wrong with the following? x is False Isn't False a singleton value? -- Grant Edwards grant.b.edwards Yow! I want a VEGETARIAN at BURRITO to go ... with gmail.com EXTRA MSG!! -- https://mail.python.org/mailman/listinfo/python-list