3

Sorry, new to Pydev and programming in Python in general. I'm trying to comment my code by putting block comments above each method. What is frustrating is that because python doesn't 'close' their methods per se (through indentation), the text editor thinks that I'm writing a comment to go inside of the previous method and gets folded into it when I collapse the method.

def __init__(self, parameters):
    code

#  *I'm trying to comment here*
def classMethod():
    code

But when I fold everything it looks like this.

def __init__(self, parameters):

def classMethod():

Anyone know a way to fix this so my comment doesn't get folded?

3
  • If these comments are docstrings, they should go inside of the methods themselves as multiline strings: def classMethod():\n '''docstring'''
    – Blender
    Jun 16, 2013 at 19:09
  • I've never used docstrings before, I just looked them up. Seems really useful if not entirely what I was looking for. This might end up better actually. Thanks!
    – Russell
    Jun 16, 2013 at 19:20
  • Of course, function documentation should be placed into a docstring. But the same issue occurs with module-level comments, which are incorrectly folded to upper function or class. Seems the old bug in old bug tracker still stands.
    – saaj
    Oct 28, 2016 at 12:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.