Getting help in Python is very easy.
Two commands can be used for this:
dir: If called without an argument, 'dir' returns all the names in the current scope.
Else it returns some of the attributes of the given object, and of attributes reachable from it.
For a module object: returns the module's attributes.
For a class object: returns its attributes, and recursively the attributes of its bases.
For any other object: returns its attributes, its class's attributes, and recursively the attributes of its class's base classes.
Objects can choose to customize default behavior of 'dir' by overriding the method __dir__
help: help (command) provides help on any of the topics.
>>> dir (list)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__',
'__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__',
'__le__' , '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__',
'__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count',
'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
# functions with underscores "_" around the names are the private helper methods
>>> help (list.extend)
extend(...)
L.extend(iterable) -> None -- extend list by appending elements from the iterable
Got a thought to share or found a bug in the code? We'd love to hear from you: