[Tutor] Python equiv of perltidy?

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Mon Jan 26 00:53:12 EST 2004

On Mon, 26 Jan 2004, kevin parks wrote:

> Is there a python equivalent of perltidy or some of the pretty printers
> that you see for c?

Hi Kevin,


should detect wacky things like ambiguous indentation.  Python also has a
command line option '-t' that warns against inconsistent tab-space usage.
But other than the tab/space issue, Python code is usually pretty anyway,
and properly indented by syntactic necessity.

If you stick to using spaces alone, should should be fairly safe.  But
your text editor should really be handling this detail for you anyway.
What text editor are you using to write Python?

By the way, there is a lint-like utility for Python that detects weird
Python usage.  The utility is called 'PyChecker':


Rather than checking syntax, it checks the semantics of a program, and
looks for things like weird parameter passing or misspelling identifiers.
It's a very useful program.

> (of course no matter how much you tidy perl, it's still perl, which by
> its very nature is untidy)

Not necessarily true.  I have seen some pretty nice Perl code before.
(Why do I suddently feel like a heretic?)

Perl, as written by its practitioners now, is often messy.  But it doesn't
remove the possibility that the Perl folks can choose to restrict
themselves to a managable subset of that language.  It's just that the
Perl folks respect obfuscated code a little too much.  *grin*

Talk to you later!

More information about the Tutor mailing list