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

split /regex/ generates code with syntax errors in multiple cases, for example: ($if1,$if2,$bytes) = split /\|/; output code is missing the right paren. Also: ($r1,$i1) = split /:/,$ingress[0]; output code...

In python 2.7, 0123 was an octal constant, same as in perl, but in Python 3+ you have to put 0o in front of your octal numbers, so this case...

Float constants starting with a '.' are translated to ' + ' in the python output. Also float constants that contain both a '.' and an 'e' are not translated...

`shift` without an argument and not in a sub should shift `@ARGV`. If shifts `perl_arg_array`, but that's not initialized.

The `defined` operator generates bad code which references `none` instead of `None`. Also `defined` of an array element or hash reference instead checks if the array or hash itself is...

open without a specified mode incorrectly defaults to 'w' (write) - the default should be 'r' (read)

Enhancement: Implement use constant. See https://perldoc.perl.org/constant

In perl, a shift/pop on an empty list returns undef. The python generated code raises an exception. Example for optional arguments: $thresh = shift; $thresh = 1000 unless defined $thresh;...

Pre-increment as a statement doesn't generate proper code: ++$i; should generate the same code as: $i++;

Perl variables/arrays/hashes are created out of whole cloth - attempt to handle some of these by checking for a reference to a var/array/hash before it's defined and inserting a definition/initialization....