fobj_list = [fobj(x[i, ...]) for i in range(n)] fx = [f() for f in fobj_list]代码解释
时间: 2024-05-19 12:15:58 浏览: 86
list的实现代码
1. `fobj_list = [fobj(x[i, ...]) for i in range(n)]`: This line creates a list of `n` elements where each element is the result of calling the function `fobj` with the `i`th slice of the `x` array. The `...` notation is used to represent any additional dimensions of the array that are not explicitly specified in the indexing.
2. `fx = [f() for f in fobj_list]`: This line creates a list of `n` elements where each element is the result of calling the function object `f` returned from the `fobj_list` with no arguments. The `fobj_list` contains function objects that were created using the `fobj` function and the `x` array.
阅读全文