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

Need to flatten qw inside anonymous arrays. For example: our %EXPORT_TAGS = ( Det => [qw( det )], Normal => [qw( det identityMatrix matrixAdd matrixScalarMultiply matrixMultiplication )], ); The value...

State variable initialized to a function argument, my var, or expression generates bad code. For example: sub banner { state $my_log_dir=$_[0]; ... } Generates: banner_my_log_dir = _args[0] While this code...

State variables are not interpolated into strings. For example: sub banner { state $inv = 'inv'; state $from_fstring = "${inv}x"; ... } $inv is renamed to banner_inv, but that name...

qx or `backticks` in list context generates incorrect code - it needs to return each line as a list element

Per the documentation: "Calling a subroutine as &foo with no trailing parentheses ignores the prototype of foo and passes it the current value of the argument list, @_. " Pythonizer...

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...

This test cases causes the pythonizer to go into an infinite loop (or infinite recursion): next if not (($year,$month,$day) = ($file =~ /^(\d{4})_(\d{2})_(\d{2})$/)) ;

Given this code: sub issue_8 { $arg1 = shift; my $arg2 = shift; } The code generated for "$arg1 = shift;" is "arg1=.pop(0)", which is a syntax error in python....

The perl code: push @arr,$val; generates only "val" in python, instead of the correct code.

Translating: print "Hello World!"; generates: print()