sgzwiz / brython

Automatically exported from code.google.com/p/brython
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Minor issues with boolean #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Boolean type cannot be checked with isinstance()

x = True
print(x)
print( isinstance(x, bool) ) => False

y = bool(1)
print(y)
print( isinstance(y, bool) ) => False

The returned value when escaping prompt() cannot be checked as a boolean 
expression
(maybe a javascript "null"):

z = prompt("Press escape key", "or push cancel button")
if z:
    print("You should not have validated the dialog box")

=> ExecutionError: ExecutionError: ExecutionError: invalid 'in' operand obj

replacing "if z: with "if z == None:" ("is" not being currently supported)

=> ExecutionError: z is null

Original issue reported on code.google.com by pedro.ro...@gmail.com on 31 Dec 2012 at 11:35

GoogleCodeExporter commented 9 years ago
Fixed in revision 290. This one was an easy one ;-)
Many thanks again Pedro !

Original comment by pierre.q...@gmail.com on 31 Dec 2012 at 1:13