Page 1 of 1

[python] TIL how to use __doc__ and help()...

Posted: Sun Dec 09, 2012 4:22 pm
by Isaac
example:
gtk.Window().__doc__

help(["a","b","c"])

Re: TIL how to use __doc__ and help()... these are important

Posted: Sun Dec 09, 2012 6:00 pm
by Jeff250
To create documentation:

Code: Select all

>>> def add(a, b):
...     '''Given two numbers a and b, returns a + b.'''
...     return a + b
... 
>>> add.__doc__
'Given two numbers a and b, returns a + b.'
>>> help(add)

Re: TIL how to use __doc__ and help()... these are important

Posted: Tue Dec 11, 2012 12:41 am
by Isaac
I better get into the habit of doing that if I'm going to start putting stuff on launchpad