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

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7137
Joined: Mon Aug 01, 2005 8:47 am

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

Post by Isaac » Sun Dec 09, 2012 4:22 pm

example:
gtk.Window().__doc__

help(["a","b","c"])
:E
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6391
Joined: Sun Sep 05, 1999 2:01 am
Location: ☃☃☃

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

Post by Jeff250 » Sun Dec 09, 2012 6:00 pm

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)
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7137
Joined: Mon Aug 01, 2005 8:47 am

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

Post by Isaac » Tue Dec 11, 2012 12:41 am

I better get into the habit of doing that if I'm going to start putting stuff on launchpad
:E
Post Reply