5

Having moved from Perl to Python one of the things I miss is "Deparse". It not only reformats perl code, but it reduces the number of parens and even changes older features to equivalent newer features.

For example:

$ perl -MO=Deparse -e 'if (($x == $b) || ($foo == $bar )) { &thing };'
if ($x == $b or $foo == $bar) {
    &thing;
}
-e syntax OK

Is there anything similar for Python?

Nam G VU
  • 30,868
  • 67
  • 216
  • 353
TomOnTime
  • 3,848
  • 2
  • 34
  • 37
  • 2
    [This](http://stackoverflow.com/questions/2625294/how-do-i-autoformat-some-python-code-to-be-correctly-formatted) might help. – devnull Apr 29 '14 at 06:25
  • 1
    There's also [2to3](https://docs.python.org/2/library/2to3.html) which updates 2.x code to be compliant with 3.x, but I'm not aware of anything similar which works across minor versions. – Matthew Trevor Apr 29 '14 at 06:56

0 Answers0