# -*- coding: iso88591 -*-
def interroga(item):
'''Apresenta informações úteis sobre o item.
'''
if hasattr(item, '__name__'):
print "NOME: ", item.__name__
if hasattr(item, '__class__'):
print "CLASSE: ", item.__class__.__name__
print "ID: ", id(item)
print "TIPO: ", type(item)
print "VALOR: ", repr(item)
print "PODE SER CHAMADA:",
if callable(item):
print "Sim"
else:
print "Não"
if hasattr(item, '__doc__'):
doc = getattr(item, '__doc__')
doc = doc.strip() # Remove leading/trailing whitespace.
firstline = doc.split('\n')[0]
print "DOC: ", firstline
syntax highlighted by Code2HTML, v. 0.9.1