[Python-ideas] gofmt for Python: standardized styling as a language feature

Eli Bendersky eliben at gmail.com
Thu Mar 26 02:00:09 CET 2015


On Wed, Mar 25, 2015 at 9:38 AM, Terry Reedy <tjreedy at udel.edu> wrote:

> On 3/25/2015 8:42 AM, Eli Bendersky wrote:
>
>>
>>
>> On Tue, Mar 17, 2015 at 8:29 PM, Eli Bendersky
>> <eliben at gmail.com
>> <mailto:eliben at gmail.com>> wrote:
>>
>>     Interesting coincidence :-)
>>
>>     We (at Google) are just on the verge of releasing an open-source
>>     tool for auto-formatting of Python code. It should be posted to
>>     Github within the next few days or weeks, under a permissive license
>>     (Apache 2.0 or something similar).
>>
>>     The tool works like gofmt and clang-format (the C++/JS version
>>     provided as part of the Clang toolchain) - it only acts on
>>     whitespace and performs re-formatting of code (PEP-8 oriented for
>>     Python but it's configurable). It does not rename
>>     variables/classes/functions to conform to any particular style. The
>>     algorithm is based on clang-format, and lib2to3 is used for the
>>     parsing side - so it's very solid. We use it on Python 2 code
>>     internally, but Python 3 support is also planned and should be easy.
>>
>>     We intend to keep actively developing the tool in the open and will
>>     be happy to accept test cases, fixes and patches in general.
>>
>>     So stay tuned!
>>
>>
>> https://github.com/google/yapf
>>
>
> yet-another-python-formatter
>
> The so-called pep8 style in style.py has
>
> # The number of spaces required before a trailing comment.
> SPACES_BEFORE_COMMENT=1,
>
> PEP8 actually says "Inline comments should be separated by at least two
> spaces from the statement.", which is what you have in the google style.
>
>
Thanks Terry. Devin opened an issue on Github and we'll fix this.

Eli






> --
> Terry Jan Reedy
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150325/30b8a7f1/attachment.html>


More information about the Python-ideas mailing list