[Twisted-Python] multiple arguments to a callback
Andrew Bennetts
andrew-twisted at puzzling.org
Fri Feb 11 21:08:35 MST 2005
On Fri, Feb 11, 2005 at 04:36:41PM -0800, snacktime wrote:
> Can you do something like this, assuming that _cbnext returns
> one,two,three,four,five ?
>
> d = req.dbpool.runInteraction(self.transaction._cbmakeDetailRec)
> d.addCallbacks(self._cbnext,log.err)
>
> def _cbnext(self,one,two,three,four,five):
The result of the callback is always passed as a single value, so you'd need
to do:
def _cbnext(self, result):
one, two, three, four, five = result
There's a short-cut for this, though: use Python's tuple-unpacking:
def _cbnext(self, (one, two, three, four, five)):
-Andrew.
More information about the Twisted-Python
mailing list