0

i'm writing a program in python with call a recursive function.

It is somewhat like:

def myfunction(list):
    if (base-case):
        # code to execute
    else:
        return [myfunction(list[0]), myfunction(list[1])]

Where the input list of myfunction is [[[element1, element2], [element1, element2]], [[element1, element2], [element1, element2]]]

with multiple-deep level of list/sublist.

Now, i like to make a multi-threading process of function "myfunction", so it can compute the sub-call of function at the same time.

I search a documentation on the net, but i found how to apply it on the classes, or with a specific example that i don't understand and i don't know to apply on my problem.

Have you any idea how to multithread this myfunction?

Thank you!

Matteo
  • 59
  • 1
  • 1
  • 5
  • It looks to me like you could [flatten the list](http://stackoverflow.com/questions/2158395/flatten-an-irregular-list-of-lists-in-python) and then use multi-threading on the result. – Andrew Morton Sep 13 '14 at 18:54
  • No, i can't flatten the list. In the example, i semplified the problem. This is a function that calculate the derivative of an math expression (in form [operand, operator, operand]). The expression (that is read as string, and imported into list structure in order to manage the priority of operators, and in order to simplify the function that derives that expression) should be managed as multi-level deep list. – Matteo Sep 13 '14 at 19:34

0 Answers0