Saturday, February 1, 2014

Python3 command line help

use help(dict) on the Python command line and replace dict with the troublesome object to see a list of its helper methods etc., e.g. items(...) D.items() -> list of D's (key, value) pairs, as 2-tuples


>>> help(list)

Help on class list in module builtins:

class list(object)
 |  list() -> new empty list
 |  list(iterable) -> new list initialized from iterable's items
 | 
 |  Methods defined here:
 | 
 |  __add__(...)
 |      x.__add__(y) <==> x+y
 | 
 |  __contains__(...)
 |      x.__contains__(y) <==> y in x
 | 
 |  __delitem__(...)
 |      x.__delitem__(y) <==> del x[y]
 | 
 |  __eq__(...)
 |      x.__eq__(y) <==> x==y
 | 
 |  __ge__(...)
 |      x.__ge__(y) <==> x>=y
 | 
 |  __getattribute__(...)
 |      x.__getattribute__('name') <==> x.name
 | 
 |  __getitem__(...)
 |      x.__getitem__(y) <==> x[y]
 | 
 |  __gt__(...)
 |      x.__gt__(y) <==> x>y
 | 
 |  __iadd__(...)
 |      x.__iadd__(y) <==> x+=y
 | 
 |  __imul__(...)
 |      x.__imul__(y) <==> x*=y
 | 
 |  __init__(...)
 |      x.__init__(...) initializes x; see help(type(x)) for signature
 | 
 |  __iter__(...)
 |      x.__iter__() <==> iter(x)
 | 
 |  __le__(...)
 |      x.__le__(y) <==> x<=y
 | 
 |  __len__(...)
 |      x.__len__() <==> len(x)
 | 
: