syntax - Why does Python not allow my comments to be indented at the proper level? -
i have python code looks this:
''' a) comments ''' try: do_stuff() ''' b) comments ''' except error: do_stuff()
but complains (b) comments syntax error - forces me indent this:
''' a) comments ''' try: do_stuff() ''' b) comments ''' except error: do_stuff()
why this, , how around it? want (b) comments @ same level "except" statement describe.
thanks
normally, triple quotes used multiline strings or docstrings, appear @ beginning of function/class/module documenting.
when not writing docstrings, recommend use normal comment syntax:
# comment
also, if want have docstrings, convention dictates use triple double quotes: """
, not '''
Comments
Post a Comment