[Chicago] Python Code Beautifiers

Kumar McMillan kumar.mcmillan at gmail.com
Tue Nov 11 19:21:22 CET 2008


Hi Samir.

while beautifiers are important for C-like languages (java, php, perl,
etc) I think you'll find that after working in Python they are not so
important.  This is mainly because indentation is forced upon you.  In
my experience, using a code formatter is important when rogue editors
mess up indentation (some emacs modes do this).  Since this results in
an immediate syntax error in python, it's not something to worry
about.

Using a beautifier is also important when there is a lack of
discipline on a team but obviously then you have a bigger problem.  If
you are on a team where you feel the need to run everything through a
code formatter I'd suggest instead to try requiring code reviews
before a developer can check in his/her code to trunk.
http://en.wikipedia.org/wiki/Code_review
A quick code review will often catch most formatting mistakes (and
laziness, like lines greater than 80 chars).  A code review is also a
psychological device that makes devs try harder to make things
readable by other devs :)

It also helps a team to agree on some conventions for your team to
follow.  I.E. http://www.python.org/dev/peps/pep-0008/

On Tue, Nov 11, 2008 at 11:49 AM, Samir Faci <samir.list at gmail.com> wrote:
> Hello everyone,
>
>    I've been sort of lurking around for a while, and just started to get a
> bit more active with python.  Now, I know that python is just beautiful and
> we all love how pretty it looks, especially compared to some other languages
> *cough* perl *cough*.  That being said, I was wondering if anyone knew of
> any code beautifiers for python.
>
> The ones I've been able to find have limited functionality.  ie reindent.py
> to fix your tabbing, and PythonTidy which I think may do what I want, but
> for some reason has no config file, aside from editing the .py file.
>
> Just looking for something like uncrustify for c++/java, where I can specify
> a format, as far as how I want my function definitions to look like, my if,
> else, etc to look like and allow my beautifier to traverse a list of .py
> files and generate a prettier version of the .py file.
>
> Any suggestions would be appreciated, if anyone has used any.
>
> --
> Samir
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>
>


More information about the Chicago mailing list