differentmatt / filbert

JavaScript parser of Python
Other
133 stars 27 forks source link

Empty tuple should be false in conditional #49

Open dideler opened 9 years ago

dideler commented 9 years ago

The "Pythonic" way to check for a non-empty tuple is if my_tuple.

t = ()
if t: # Should be false (does not work)

if (): # Should be false (does not work, raises error - see issue #48)

if (1, 2): # Should be true (works, but see comment in issue #48)

Note that bool() evaluates tuples correctly in filbert; the issue seems to just be with conditionals.