PDA

View Full Version : question on code [twisted framework]



mo.reina
September 15th, 2010, 11:12 PM
just want to make sure i'm understanding this right...

main function:

.....
.....
for address in addresses:
host, port = address
get_poetry(host, port, got_poem, poem_failed)
.....
.....

get_poetry function:

.....
.....
from twisted.internet import reactor
factory = PoetryClientFactory(callback, errback)
reactor.connectTCP(host, port, factory)
.....
.....

is the following code creating one factory for each address? i'd imagine so, since the get_poetry function is being called once for each address, but since i'm still learning the framework i´m not totally sure....

mo.reina
September 16th, 2010, 09:12 AM
bump