I am looking at this tutorial in twisted python. https://github.com/jdavisp3/twisted-intro/blob/master/twisted-client-3/get-poetry.py
def get_poetry(host, port, callback):
"""
Download a poem from the given host and port and invoke
callback(poem)
when the poem is complete.
"""
from twisted.internet import reactor
factory = PoetryClientFactory(callback)#I am interested in checking the instances alive here
reactor.connectTCP(host, port, factory)
def poetry_main():
addresses = parse_args()
from twisted.internet import reactor
poems = []
def got_poem(poem):
poems.append(poem)
if len(poems) == len(addresses):
reactor.stop()
for address in addresses:
host, port = address
get_poetry(host, port, got_poem)
reactor.run()
for poem in poems:
print poem
if __name__ == '__main__':
poetry_main()
I have never really debugged python before.
I wanted to see which classes's instances are alive before the reactor.stop fires.
I was checking this Printing all instances of a class
with this code
import gc
for obj in gc.get_objects():
How can I selectively view the top most information and then further inherited data and so on?
From a twisted point of view, I want see which factory instances are currently active and how is it related to the protocols