How to perform element-wise arithmetic operations (e.g. add, subtract, multiply) of two equally shaped lists with arbitrary nestings
问题 I want to perform element-wise mathematical operations (e.g. sum, multiply..) on two Python lists containing numbers or multiple nested lists which may contain again numbers or lists and so on. The shapes of the two lists are equal when performing the operation. Furthermore, the result should be of the same shape as the two input lists. A shape may differ in: length , width (i.e. number of nestings), order (e.g. the lists start with a number followed by a nested list, but it may also be that