On Fri, 07 Jul 2017 02:48:45 +0000, Stefan Ram wrote: >>>> def isfalse( x ): > ... return x == 0 and str( type( x )) == "<class 'bool'>" > ... >
Don't depend on string representations of objects, unless you know what you're doing. Do this instead: def isfalse(x): return x == 0 and type(x) is bool And why test against 0 in a function called isfalse? def isfalse(x): return x == False and type(x) is type(False) Dan -- https://mail.python.org/mailman/listinfo/python-list