Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE 'strip trailing whitespace' changes multiline strings #75658

Closed
mr-nfamous mannequin opened this issue Sep 14, 2017 · 2 comments
Closed

IDLE 'strip trailing whitespace' changes multiline strings #75658

mr-nfamous mannequin opened this issue Sep 14, 2017 · 2 comments
Assignees
Labels
3.7 (EOL) end of life topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@mr-nfamous
Copy link
Mannequin

mr-nfamous mannequin commented Sep 14, 2017

BPO 31477
Nosy @terryjreedy, @mr-nfamous

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

GitHub fields:

assignee = 'https://github.com/terryjreedy'
closed_at = <Date 2017-09-15.21:58:02.491>
created_at = <Date 2017-09-14.19:59:30.290>
labels = ['expert-IDLE', 'type-bug', '3.7']
title = "IDLE 'strip trailing whitespace' changes multiline strings"
updated_at = <Date 2017-09-15.21:58:02.490>
user = 'https://github.com/mr-nfamous'

bugs.python.org fields:

activity = <Date 2017-09-15.21:58:02.490>
actor = 'terry.reedy'
assignee = 'terry.reedy'
closed = True
closed_date = <Date 2017-09-15.21:58:02.491>
closer = 'terry.reedy'
components = ['IDLE']
creation = <Date 2017-09-14.19:59:30.290>
creator = 'bup'
dependencies = []
files = []
hgrepos = []
issue_num = 31477
keywords = []
message_count = 2.0
messages = ['302204', '302274']
nosy_count = 2.0
nosy_names = ['terry.reedy', 'bup']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue31477'
versions = ['Python 3.6', 'Python 3.7']

@mr-nfamous
Copy link
Mannequin Author

mr-nfamous mannequin commented Sep 14, 2017

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.

@mr-nfamous mr-nfamous mannequin assigned terryjreedy Sep 14, 2017
@mr-nfamous mr-nfamous mannequin added topic-IDLE type-bug An unexpected behavior, bug, or error labels Sep 14, 2017
@terryjreedy
Copy link
Member

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')
>>> s
'space \ntab\t\nline3\n'

I am revising the doc to make the rstring behavior clearer.

@terryjreedy terryjreedy added the 3.7 (EOL) end of life label Sep 15, 2017
@terryjreedy terryjreedy changed the title IDLE 'strip trailing whitespace' changes the value of multiline strings IDLE 'strip trailing whitespace' changes multiline strings Sep 15, 2017
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life topic-IDLE type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant