Best way to document Python code...

Gabriel Genellina gagsl-py at yahoo.com.ar
Mon Jan 22 16:12:13 EST 2007


At Monday 22/1/2007 17:48, Boris Ozegovic wrote:

>Does Python has API just like in Java, for example
>http://java.sun.com/j2se/1.5.0/docs/api/allclasses-noframe.html ctrl-f and
>than click on class you are searching for, and finally you get clean list
>of all fields and methods.  Where can I find similar in Python, for
>example, if I would like to see which methods list/dictionary has.

Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
py> help(dict)
Help on class dict in module __builtin__:

class dict(object)
  |  dict() -> new empty dictionary.
  |  dict(mapping) -> new dictionary initialized from a mapping object's
  |      (key, value) pairs.
  |  dict(seq) -> new dictionary initialized as if via:
  |      d = {}
  |      for k, v in seq:
  |          d[k] = v
  |  dict(**kwargs) -> new dictionary initialized with the name=value pairs
  |      in the keyword argument list.  For example:  dict(one=1, two=2)
  |
  |  Methods defined here:
  |
  |  __cmp__(...)
  |      x.__cmp__(y) <==> cmp(x,y)
  |
  |  __contains__(...)

You should skip at first magic __methods__. You can use help() with 
any object, or language keyword: help("if")

py> import math
py> help(math)
Help on built-in module math:

NAME
     math

FILE
     (built-in)

DESCRIPTION
     This module is always available.  It provides access to the
     mathematical functions defined by the C standard.

FUNCTIONS
     acos(...)
         acos(x)

         Return the arc cosine (measured in radians) of x.
[...]


-- 
Gabriel Genellina
Softlab SRL 


	

	
		
__________________________________________________ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 




More information about the Python-list mailing list