[Chicago] Python Code Beautifiers

Kumar McMillan kumar.mcmillan at gmail.com
Tue Nov 11 20:45:39 CET 2008


On Tue, Nov 11, 2008 at 1:32 PM, Samir Faci <spam at esamir.com> wrote:
> hmmmm, is he?  That really is good to know, though the next question is...
> is he scriptable?   can kumar be executed as a cron job given beer is piped
> in as stdin.   :P

might work with scotch or whiskey

>
> I was gonna answer to that email, but that reply is probably gonna be a bit
> more long winded, I'll send that out when I get home.
>
> Okay, pylint is very sweet.  I like the output and all the details, but
> unless I'm missing something, it's simply a code analyzer, it doesn't
> actually modify the code.
> I was looking for something that given a certain config would alter or
> generate a copy of my code with the modification passed in via the config
> file.  I believe both PyChecker and pylint are just a validation tool to
> ensure that your code is decent.
> --
> Samir
>
>
> Garrett Smith wrote:
>>
>> Samir,
>>
>> I agree with Kumar -- *he* is an excellent code beautifier. I believe he
>> is available under one of the "free beer" licenses.
>>
>> Cheers!
>>
>> ----- "Kumar McMillan" <kumar.mcmillan at gmail.com> wrote:
>>
>>
>>>
>>> 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
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Chicago mailing list
>>> Chicago at python.org
>>> http://mail.python.org/mailman/listinfo/chicago
>>>
>>
>> _______________________________________________
>> Chicago mailing list
>> Chicago at python.org
>> http://mail.python.org/mailman/listinfo/chicago
>>
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>


More information about the Chicago mailing list