Swift
的自定义Xcode 8
关闭中添加文档(使用内置功能而非第三方)的正确格式是什么?closure
parameters
?closure
return type
?示例:
struct S1 {
/// This block is executed after completion
var completion : (String, Int) -> (Bool)
}
Xcode 8
内置了向自定义代码添加文档的功能。
可以通过执行以下操作之一来完成此操作:
Command
+ Option
+ Click
继续关注代码和Editor
> Structure
> Add documentation
答案 0 :(得分:1)
如果给定位置不支持这些标记,那么现在唯一可行的解决方法就是:
import numba as nb
def f(x):
return x*x
def call_func(func): # only take func
func = nb.njit(func) # compile func in nopython mode!
@nb.njit
def inner(x):
return func(x)
return inner # return the closure
if __name__ == '__main__':
call_func_with_f = call_func(f) # compile once
print(call_func_with_f(5)) # call the compiled version
print(call_func_with_f(5)) # call the compiled version
print(call_func_with_f(5)) # call the compiled version
print(call_func_with_f(5)) # call the compiled version
print(call_func_with_f(5)) # call the compiled version