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

Wrong code generated for choosing multiple elements from array #84

Open snoopyjc opened 2 years ago

snoopyjc commented 2 years ago

Wrong code generated for choosing multiple elements from array. For example:

($this, $that, $other) = @arr[0,1,4];

generates:

[this, that, other] = arr[0,1,4]

proper code would be:

[this, that, other] = [arr[i] for i in [0,1,4]]
snoopyjc commented 2 years ago

Implemented in https://github.com/snoopyjc/pythonizer v0.921