fork download
  1.  
  2. def info(object, spacing=10, collapse=1):
  3. """Print methods and doc strings.
  4.  
  5. Takes module, class, list, dictionary, or string."""
  6. methodList = [e for e in dir(object) if callable(getattr(object, e))]
  7. processFunc = collapse and (lambda s: " ".join(s.split())) or (lambda s: s)
  8. print("\n".join(["%s %s" %
  9. (method.ljust(spacing),
  10. processFunc(str(getattr(object, method).__doc__)))
  11. for method in methodList]))
  12.  
  13.  
  14. print(info.__doc__)
  15. li=[]
  16. info(li)
Success #stdin #stdout 0.02s 9936KB
stdin
Standard input is empty
stdout
None
__add__    Return self+value.
__class__  list() -> new empty list list(iterable) -> new list initialized from iterable's items
__contains__ Return key in self.
__delattr__ Implement delattr(self, name).
__delitem__ Delete self[key].
__dir__    __dir__() -> list default dir() implementation
__eq__     Return self==value.
__format__ default object formatter
__ge__     Return self>=value.
__getattribute__ Return getattr(self, name).
__getitem__ x.__getitem__(y) <==> x[y]
__gt__     Return self>value.
__iadd__   Implement self+=value.
__imul__   Implement self*=value.
__init__   Initialize self. See help(type(self)) for accurate signature.
__iter__   Implement iter(self).
__le__     Return self<=value.
__len__    Return len(self).
__lt__     Return self<value.
__mul__    Return self*value.n
__ne__     Return self!=value.
__new__    Create and return a new object. See help(type) for accurate signature.
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__repr__   Return repr(self).
__reversed__ L.__reversed__() -- return a reverse iterator over the list
__rmul__   Return self*value.
__setattr__ Implement setattr(self, name, value).
__setitem__ Set self[key] to value.
__sizeof__ L.__sizeof__() -- size of L in memory, in bytes
__str__    Return str(self).
__subclasshook__ Abstract classes can override this to customize issubclass(). This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
append     L.append(object) -> None -- append object to end
clear      L.clear() -> None -- remove all items from L
copy       L.copy() -> list -- a shallow copy of L
count      L.count(value) -> integer -- return number of occurrences of value
extend     L.extend(iterable) -> None -- extend list by appending elements from the iterable
index      L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
insert     L.insert(index, object) -- insert object before index
pop        L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
remove     L.remove(value) -> None -- remove first occurrence of value. Raises ValueError if the value is not present.
reverse    L.reverse() -- reverse *IN PLACE*
sort       L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE*