Skip to content

IDLE 'strip trailing whitespace' changes multiline strings #75658

Closed

Description

@mr-nfamous
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']

Activity

  1. mr-nfamous commented on Sep 14, 2017

    mr-nfamousmannequin
    MannequinAuthor

    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.

  2. added
    type-bug
    on Sep 14, 2017
  3. terryjreedy commented on Sep 15, 2017

    @terryjreedy
    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.

  4. changed the title [-]IDLE 'strip trailing whitespace' changes the value of multiline strings[/-] [+]IDLE 'strip trailing whitespace' changes multiline strings[/+] on Sep 15, 2017
  5. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.7 (EOL)topic-IDLEtype-bug

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions