First time here? Check out the FAQ!

Toggle Block Comment flattens if statemets

Hi, RIght now, when you enforce formatting with PEP8, after saving such formatted block after commenting it, it changes this:

##if data:
##    print('aaa')
##    print("bbb")

To that:

# if data:
# print('aaa')
# else:
# print("bbb")

Is there a way to modify/fix it?

KhazAkar's avatar
asked 2022-05-04 09:41:05 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

1 Answer


This happens if you enable the Editor > Auto-Formating > PEP8: Spaces after # preference. Autopep8, which is what is being used to do the reformatting, tries to see if the content of a comment is code and if so it doesn't reformat it, but that determination seems to be skipped when that option is enabled.

It looks like our default for this preference is currently to enable it, but given this quirk I'm thinking the default should instead be to disable it. We'll look into making that change in the future.

Wingware Support's avatar
Wingware Support
answered 2022-05-04 09:52:26 -0500
edit flag offensive 0 remove flag delete link


Thanks a lot, disabling this option helped :)

KhazAkar's avatar KhazAkar (2022-05-04 10:28:05 -0500) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer