Steven Lee Steven Lee - 7 months ago 59
Python Question

Python asterisk before function

I am following this tutorial:

and in one of the lines there is the function:

(cnts, boundingBoxes) = zip(*sorted(zip(cnts, boundingBoxes),
key=lambda b:b[1][i], reverse=reverse))

I want to know what is the use of the asterisk before the
function call.


You need to understand what the code is trying to do. The first part sorted(zip(cnts, boundingBoxes) creates a sorted list which is the zipped version of contours and boundingBoxes. The asterisk "unzips" it so that the outer zip can produce the correct output.