softpano / pythonizer

Translator (or more correctly transcriber) from Perl to Python
http://www.softpanorama.org/Scripting/Pythonorama/Python_for_perl_programmers/Pythonizer/index.shtml
Other
39 stars 17 forks source link

Statement with both a bash-style "and" and a trailing "if" generates wrong code #116

Open snoopyjc opened 2 years ago

snoopyjc commented 2 years ago

Statement with both a bash-style "and" and a trailing "if" generates wrong code. For example:

go_outside() and play() unless $is_raining;

generates:

if go_outside():
    if not (is_raining):
        play()

but the correct code is:

if not (is_raining):
    if go_outside():
        play()
snoopyjc commented 2 years ago

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