Lines Matching refs:thing
6 help. Calling help(thing) on a Python object documents the object.
1437 def describe(thing):
1438 """Produce a short description of the given thing."""
1439 if inspect.ismodule(thing):
1440 if thing.__name__ in sys.builtin_module_names:
1441 return 'built-in module ' + thing.__name__
1442 if hasattr(thing, '__path__'):
1443 return 'package ' + thing.__name__
1445 return 'module ' + thing.__name__
1446 if inspect.isbuiltin(thing):
1447 return 'built-in function ' + thing.__name__
1448 if inspect.isgetsetdescriptor(thing):
1450 thing.__objclass__.__module__, thing.__objclass__.__name__,
1451 thing.__name__)
1452 if inspect.ismemberdescriptor(thing):
1454 thing.__objclass__.__module__, thing.__objclass__.__name__,
1455 thing.__name__)
1456 if inspect.isclass(thing):
1457 return 'class ' + thing.__name__
1458 if inspect.isfunction(thing):
1459 return 'function ' + thing.__name__
1460 if inspect.ismethod(thing):
1461 return 'method ' + thing.__name__
1462 if type(thing) is types.InstanceType:
1463 return 'instance of ' + thing.__class__.__name__
1464 return type(thing).__name__
1493 def resolve(thing, forceload=0):
1495 if isinstance(thing, str):
1496 object = locate(thing, forceload)
1498 raise ImportError, 'no Python documentation found for %r' % thing
1499 return object, thing
1501 name = getattr(thing, '__name__', None)
1502 return thing, name if isinstance(name, str) else None
1504 def render_doc(thing, title='Python Library Documentation: %s', forceload=0):
1506 object, name = resolve(thing, forceload)
1529 def doc(thing, title='Python Library Documentation: %s', forceload=0):
1532 pager(render_doc(thing, title, forceload))
1536 def writedoc(thing, forceload=0):
1539 object, name = resolve(thing, forceload)