[issue5150] IDLE to support reindent.py

Terry J. Reedy report at bugs.python.org
Mon Nov 18 01:11:22 EST 2019


Terry J. Reedy <tjreedy at udel.edu> added the comment:

reindent.py does the following:

1. Change Python (.py) files to use 4-space indents and no hard tab characters.  IDLE editor does this by default, as do other programming editors, except as PEP8 recommends something else for continuation lines within fences <(), [], {}>.  Before doing anything with reindent, I would want to check whether it messes with IDLE;s smart indents.

The format module and Format menu has functions to add/remove tabs and changes space indents, as well as rewrap.

The only thing left is dealing with a messed up file, but suspect that this is rarer than 19 (1st public version of reindent.py) or even 10 years ago (this issue).  Is this issue still needed?

2. Trim excess spaces and tabs from ends of lines.  Format => strip whitespace, added on this issue, does this. (The code is now in the format module.)

3. Remove empty lines at the end of files.  Rstrip should do this but does not.  This is a separate issue from reindenting.

4. Ensure that the last line ends with a newline.  Save in iomenu ensures this, but this should be part of 'strip whitespace', especially if we 'rstrip' on save (#33046).

----------
nosy: +taleinat

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue5150>
_______________________________________


More information about the Python-bugs-list mailing list