(May-05-2018, 06:43 AM)oldDog Wrote: I don't want to add the '#' character because that will comment everything out and only i will be able to see the text.Comment
#
is meant for you and other who read your code.There is way with
docstring
in function and class.Then can look at what's in docstring with
help()
and __doc__
.Example:
def foo(): '''The meaning of life, the universe, and everything''' return 42Usage:
>>> help(foo) Help on function foo: foo() The meaning of life, the universe, and everything >>> foo.__doc__ 'The meaning of life, the universe, and everything' >>> foo() 42
Class:
class Bar(): ''' This class dos This Need to explain more ''' var = 999 def run(self): '''This method do run something''' passUsage:
>>> Bar.__doc__ '\n This class dos This\n Need to explain more\n '
Output:>>> help(Bar)
Help on class Bar in module builtins:
class Bar(object)
| This class dos This
| Need to explain more
|
| Methods defined here:
|
| run(self)
| This method do run something
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| var = 999