pythonizer icon indicating copy to clipboard operation
pythonizer copied to clipboard

Perl ? : operator generates bad code

Open snoopyjc opened this issue 4 years ago • 1 comments

Perl ? : operator generates bad code if the first part is not parenthesized, or if it's not directly used in an assignment statement. For example:

$redirect = $options{debug} ? "2>&1" : "2>&1 >/dev/null";

Generates:

redirect='2>&1' if ['debug' else '2>&1 >/dev/null'

snoopyjc avatar Nov 19 '21 15:11 snoopyjc

Fixed in https://github.com/snoopyjc/pythonizer

snoopyjc avatar Feb 07 '22 16:02 snoopyjc