Help Create Good Data Model

fumanchu fumanchu at
Mon Mar 13 01:07:52 CET 2006

If you used a Queue, it wouldn't be the container itself; rather, it
would be a gatekeeper between the container and consumer code. A
minimal example of user-side code would be:

class Request:
    def __init__(self, op, data):
        self.op = op = data
        self.reply = None
req = Request('get', key)
data_q.put(req, block=True)
while req.reply is None:

The container-side code would be:

while True:
    request = data_q.get(block=True)
    request.reply = handle(request)

That can be improved with queue timeouts on both sides, but it shows
the basic idea.

Robert Brewer
System Architect
Amor Ministries
fumanchu at

More information about the Python-list mailing list