Description
When using isinstance() with a tuple of types (common Python pattern), the output is incorrect.
Python Input
if isinstance(obj, (list, tuple, dict)):
pass
Current Output (v1.3.1)
if (isinstance(obj, tuple(list, tuple, dict))) {
}
Problem
tuple(list, tuple, dict) calls the tuple function with three arguments, which is wrong. The Python tuple here is just a literal grouping of types.
Expected Output (Option A - Direct translation)
if (isinstance(obj, [list, tuple, dict])) {
}
Expected Output (Option B - Native JS)
if (Array.isArray(obj) || obj instanceof Set || obj instanceof Map) {
}
Test Case
# Multiple type check
isinstance(x, (int, float, complex))
# Single type check (works correctly)
isinstance(x, int)
Priority
🟡 Medium - Common pattern in Python code
Description
When using
isinstance()with a tuple of types (common Python pattern), the output is incorrect.Python Input
Current Output (v1.3.1)
Problem
tuple(list, tuple, dict)calls thetuplefunction with three arguments, which is wrong. The Python tuple here is just a literal grouping of types.Expected Output (Option A - Direct translation)
Expected Output (Option B - Native JS)
Test Case
Priority
🟡 Medium - Common pattern in Python code