Python Source Code Beautifier
Michael Spencer
mahs at telcopartners.com
Tue Feb 27 12:27:32 EST 2007
Franz Steinhaeusler wrote:
> Use Spaces, size: 4
> detect mixed line ending
> detect tabs mixed with space
> trim trailing whitespaces.
look at: tools/scripts/reindent.py
> convert structs like: if (a > b): to if a > b:
> fill in spaces, but not in functions between operators:
>
> a+=1 => a += 1
> p(t + 1) => p(t+1)
>
an ast pretty printer could do this sort of thing. I saw someone post about one
on this list a couple of years ago, but can't quickly turn up the link.
>
> from "is" to "==" and "is not" to "!=" (ok a find replace could do that
> easily also), but in a program that would be more comfortable.
careful!
>>> (1,2,3) == (1,2,3)
True
>>> (1,2,3) is (1,2,3)
False
>>>
Michael
More information about the Python-list
mailing list