I have a simple function that tests an item in a tuple to see if it is truthy or not. For some reason all tests come back True (...if connection:...
), even though the value being tested is either a 1 (assumed True) or 0 (assumed false).
I tested to see if 1 == True (output: True), 1 == False (False), connection is True (False) just to try to understand what is going on.
User input: players = [('a', 1), ('b', 0)]
Function:
def validplayers(players):
for player, connection in players:
if connection:
player
print player, connection, 1 == True, 1 == False, connection is True
Output:
a 1 True False False
b 0 True False False
The connection
var is passing a 1 or 0 which type(connection)
defines as an int.