This function is supposed to be purely cosmetic. It just cleans up the junk whitespace commonly left behind when coding. But it could cause a problem when someone expects some string they defined to stay the same value, and then use that function and all of a sudden they have a crazy bug that you wouldn't even know how to find.
The current behavior of IDLE's feature is standard, not a bug. The cpython respository does not currently accept .py, .c, or .rst files with any trailing whitespace. <pythondir>/tools/scripts/patchcheck.py strips trailing whitespace from all lines. Notepad++, a widely used multi-language Windows programmer's editor, does the same.
I am aware of the potential surprise. If one wants multiline strings with embedded trailing whitespace, one should avoid trailing whitespace strippers or use Python's string concatenation feature.
>>> s = ('space \n''tab\t\n''line3\n')
I am revising the doc to make the rstring behavior clearer.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
The text was updated successfully, but these errors were encountered: