First time here? Check out the FAQ!
1

Obtain the pycharm style block comment.
 

In Wing, I want to obtain the pycharm style block comment, say, for the following code block snippet in a class:

def measure_strain(self) -> float:
    """Measures the average strain on bond lengths on both substructures."""
    bond_lengths = self.bond_lengths
    bottom_strain = []
    top_strain = []
    for (k1, b1) in bond_lengths.items():
        for k3, b3 in self.bbl.items():
            if (k3 == k1) or (k3[::-1] == k1):
                d = np.abs((b3 - b1)) / b1 * 100
                bottom_strain.append(d)
        for k3, b3 in self.tbl.items():
            if (k3 == k1) or (k3[::-1] == k1):
                d = np.abs((b3 - b1)) / b1 * 100
                top_strain.append(d)
    strain = np.average(bottom_strain) + np.average(top_strain)
    return strain

In wing, the result is as following with the # Indented PEP 8 Style Comment

# def measure_strain(self) -> float:
    # """Measures the average strain on bond lengths on both substructures."""
    # bond_lengths = self.bond_lengths
    # bottom_strain = []
    # top_strain = []
    # for (k1, b1) in bond_lengths.items():
        # for k3, b3 in self.bbl.items():
            # if (k3 == k1) or (k3[::-1] == k1):
                # d = np.abs((b3 - b1)) / b1 * 100
                # bottom_strain.append(d)
        # for k3, b3 in self.tbl.items():
            # if (k3 == k1) or (k3[::-1] == k1):
                # d = np.abs((b3 - b1)) / b1 * 100
                # top_strain.append(d)
    # strain = np.average(bottom_strain) + np.average(top_strain)
    # return strain

But I want to obtain the pycharm style block comment as follows:

# def measure_strain(self) -> float:
#     """Measures the average strain on bond lengths on both substructures."""
#     bond_lengths = self.bond_lengths
#     bottom_strain = []
#     top_strain = []
#     for (k1, b1) in bond_lengths.items():
#         for k3, b3 in self.bbl.items():
#             if (k3 == k1) or (k3[::-1] == k1):
#                 d = np.abs((b3 - b1)) / b1 * 100
#                 bottom_strain.append(d)
#         for k3, b3 in self.tbl.items():
#             if (k3 == k1) or (k3[::-1] == k1):
#                 d = np.abs((b3 - b1)) / b1 * 100
#                 top_strain.append(d)
#     strain = np.average(bottom_strain) + np.average(top_strain)
#     return strain

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
hongyi-zhao's avatar
557
hongyi-zhao
asked 1 year ago
Wingware Support's avatar
4.2k
Wingware Support
updated 1 year ago

Comments

see more comments

3 Answers

1

For your information, you can see the following effect commented out by pycharm:

image description

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
hongyi-zhao's avatar
557
hongyi-zhao
answered 1 year ago
link

Comments

see more comments
0

Set the Editor > Block Comment Style preference to "# PEP 8 Style Comment in Column 0". The indented style is often easier if you're working near commented-out code a lot or moving it around, which I think is why the default in Wing is indented. I suspect the default also predates PEP8!

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Wingware Support's avatar
4.2k
Wingware Support
answered 1 year ago
link

Comments

No. I don't want them always in "Column 0", instead, the comment symbol, aka, "#", is placed in the column where the actual indentation position of the code block is located, which is also the behavior of pycharm comment style.

hongyi-zhao's avatar hongyi-zhao (1 year ago)

That looks like a useful option. We'll try to implement it. Thanks!

Wingware Support's avatar Wingware Support (1 year ago)
see more comments
0

"No. I don't want them always in "Column 0", instead, the comment symbol, aka, "#", is placed in the column where the actual indentation position of the code block is located, which is also the behavior of pycharm comment style."

Thanks again for this suggestion. This will be added in our next release by the "# Uniformly Indented PEP8 Style Comment" option for the Editor > Block Comment Style preference.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Wingware Support's avatar
4.2k
Wingware Support
answered 1 year ago, updated 1 year ago
link

Comments

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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)