You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that Python boolean operator '|=' was translated to '|=' in Javascript. They look the same, but they are not the same.
In Javascript, '|=' is a bitwise operator returning 1 or 0, not true or false. Javascript has another operator for boolean operations, '||=' returning true or false. Following is examples showing the difference:
The text was updated successfully, but these errors were encountered:
chopin
changed the title
A boolean operation is translated to a bitwise operation, not a boolean operation
A boolean operator is translated to a bitwise operator, not a boolean operator
Jun 11, 2023
It seems that Python |= operates either in boolean or in bitwise depending on the types of its operands, but Javascript doesn't. Does Transcyprt have an option to translate it correctly? Should I modified all Python source code using boolean operators?
I found that Python boolean operator '|=' was translated to '|=' in Javascript. They look the same, but they are not the same.
In Javascript, '|=' is a bitwise operator returning 1 or 0, not true or false. Javascript has another operator for boolean operations, '||=' returning true or false. Following is examples showing the difference:
output result:
Thanks.
The text was updated successfully, but these errors were encountered: