I use a lot the code pattern:
1 class myTest():
2 counter = 0 # use this as general counter
3 name_code = '' # this is the name encoded using the
4 # standard as defined in ...
5 category = '' # category of test
Line 4 is not PEP8 standard. # should be at position 5 which looks IMHO just ugly:
3 name_code = '' # this is the name encoded using the
4 # standard as defined in ...
How do you comment such a pattern? What is best practice?
I would document the variables in the class docstring, because they are static members of the class. This way your actual code stays more compact, and easier to read and digest:
class myTest():
"""Test class which does something.
Attributes:
counter (int): Use this as general counter.
name_code (str): This is the name encoded using the
standard as defined in this long piece of text.
Just continue the lines with one level of indentation
for as long as you want.
category (str): Category of the test.
"""
counter = 0
name_code = ''
category = ''
I've used the Google style Python docstring here, because that's just my preferred style for these.