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

Guido van Rossum guido at python.org
Fri Mar 20 00:55:08 CET 2015


On Thu, Mar 19, 2015 at 2:30 PM, Terry Reedy <tjreedy at udel.edu> wrote:

> On 3/19/2015 5:01 PM, Guido van Rossum wrote:
>
>> On Thu, Mar 19, 2015 at 1:40 PM, Terry Reedy <tjreedy at udel.edu
>>
>
>      Having the guidelines numbered (id'ed), even though still regarded
>>     as guidelines, could help communication. Checkers could then easily
>>     refer to specific guidelines.
>>
>> I worry this will just encourage the nit-picky attitude more.
>>
>
> I agree that this is a possible negative.
>

I'll leave the rest of the discussion to other participants. It seems all
possible POVs are well-represented.


>      Thanks for the link.  I was specifically thinking of global
>>     renamings to satisfy PEP 8's Naming Conventions.  Idlelib has a
>>     mishmash of module and function/method name styles.  (I might look
>>     and see what can be done with the undocumented (except as
>>     'unstable') libe2to3.)
>>
>> This feels hard to automate, because you don't know what names are part
>> of an external specification.
>>
>
> Modernizing idlelib names, in relation to PEP 434, is a separate
> discussion.
>
>  I think that a quick "clean up whitespace" feature would be a nice
>> addition to IDLE, provided it's a user-selectable menu items (similar to
>> the existing indent/dedent operations).
>>
>
> The Format menu now has 'Strip trailing whitespace', which may be new
> since you last looked.  It needs to strip trailing blank lines, as
> reindent.py does, in addition to trailing whitespace on each line, to make
> files ready to commit to the cpython repository.  Did you have in mind also
> doing within-line cleanups (as a separate menu entry)?
>

I probably spoke out of turn (I haven't really used IDLE in years). But I
could imagine another command that did something like autopep8 on a
selection, making sure the whitespace around various operators is
consistent with PEP 8, fixing indentation levels, and even
inserting/removing blank lines in certain cases. I'm not sure I would want
it to automatically break long lines, as I often have very specific ideas
about the best place to break a long line, which require understanding the
meaning of the code.

Have you used Emacs? The python-mode written by Tim Peters and maintained
by Barry Warsaw has some pretty amazing reformatting capabilities (though I
rarely use them, because my fingers automatically type correctly formatted
code :-).

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150319/9315f5f5/attachment.html>


More information about the Python-ideas mailing list