differentmatt / filbert

JavaScript parser of Python
Other
133 stars 27 forks source link

Compound Boolean Expressions don't work properly #28

Open nemoyatpeace opened 10 years ago

nemoyatpeace commented 10 years ago

This is from the Filbert Interactive Testing page:

a = 5
b = 5

if a == b > 4:
    print('Compound Works')
else:
    print('Compound Fails')

if a==b and b>4:
    print('And Works')
else:
    print('And Fails')

Output:

Compound Fails
And Works

Both should work.

danieltanfh95 commented 10 years ago

I tested the first, and apparently the parser does this: (5==5)>4 which gives 1>4, which is false. Python3 parses it as ternary conditionals, like so: 5==5 and 5>4

differentmatt commented 10 years ago

Nice, thanks for the reduced repros.

https://docs.python.org/3.4/library/stdtypes.html#comparisons