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

Fix idlelib.help comments #15669

Merged
merged 2 commits into from
Sep 5, 2019
Merged

Conversation

terryjreedy
Copy link
Member

Format comments as sentences and use sentences when possible.

@terryjreedy
Copy link
Member Author

@taleinat I made minor changes to comment texts and will consider a few more.

I think I found a mismatch between indent() and one of its calls.

    def indent(self, amt=1):
        "Change indent (+1, 0, -1) and tags."
        self.level += amt
        self.tags = '' if self.level == 0 else 'l'+str(self.level)
    ...    
        if tag in ['h1', 'h2', 'h3']:
            self.indent(0)  # Clear tag, reset indent.

The comment asserts that self.indent(0) will set self.level to 0 and then self.tags to ''. But it leaves self.level alone and only resets self.tags if self.level was already 0. As it turns out, the latter is always true, as I would expect it to be if +1s and -1s are properly matched. So I think the call should be replaced with self.tags = '', possible preceded by assert self.level == 0.

@taleinat
Copy link
Contributor

taleinat commented Sep 4, 2019

I think I found a mismatch between indent() and one of its calls.

I noticed that too but didn't investigate.

I suggest separating into three methods: indent(), dedent() and reset_indent().

Copy link
Contributor

@taleinat taleinat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment changes look fine to me.

Lib/idlelib/help.py Outdated Show resolved Hide resolved
Lib/idlelib/help.py Outdated Show resolved Hide resolved
@terryjreedy
Copy link
Member Author

After more thought, I went with assert at the beginning of the block, as I am pretty sure level != 0 would indicate an error somewhere. The set tags at the end of the block, as done for other blocks.

@terryjreedy terryjreedy merged commit 6cd9666 into python:master Sep 5, 2019
@terryjreedy terryjreedy deleted the help_comments branch September 5, 2019 00:20
@miss-islington
Copy link
Contributor

Thanks @terryjreedy for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-15683 is a backport of this pull request to the 3.8 branch.

@bedevere-bot
Copy link

GH-15684 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 5, 2019
(cherry picked from commit 6cd9666)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 5, 2019
(cherry picked from commit 6cd9666)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
miss-islington added a commit that referenced this pull request Sep 5, 2019
(cherry picked from commit 6cd9666)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
miss-islington added a commit that referenced this pull request Sep 5, 2019
(cherry picked from commit 6cd9666)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants