pythonizer icon indicating copy to clipboard operation
pythonizer copied to clipboard

Translator (or more correctly transcriber) from Perl to Python

Results 100 pythonizer issues
Sort by recently updated
recently updated
newest added

Perl code of the form: $f =~ s/this/that/flags; generates bad python code.

Bare words in array initializations, hash initializations, and hash references are not translated properly into python strings. Examples: @regions=(AP,EMEA,LA,Canada); %hash1=(This=>"this", That=>"that", Two=>2); $options{OPTION}=1;

Changing array length via any of: $#words++; ++$#words; $words[++$#words] = 'new Last'; $#words = 0; generates incorrect code.

In this statement, the "prev_state" variable is omitted from the generated code: $bool = $state_chg && ($prev_state == $ST_GLOBAL);

ABEND: The number of generated chunk exceeed 256 for this code: $bool = -e "$tmdir/$region/tm.wnet.$hour" or -e "$tmdir/$region/tm.wnet.$hour.Z";

pythonizer goes into a tight loop on: next if /^#/;

default_var is not set in the generated code on while() { ... }

Subexpression parens are missing on postfix control when subexpression begins with a paren. For example: print "found snmp data for hour $hour\n" if (-f "$cttdir/bytes.$hour" or -f "$cttdir/bytes.$hour.Z") and $options{debug};...

The perl "unless" construct generated an "if not" in python, but it fails to keep the parenthesis so it's probably wrong code: unless (($area_hidden) || ($area_rtr_hidden) || ($intf_hidden) || ($link_hidden))...