当参数在方括号中时,文档中的含义是什么?

What does it mean in documentation when arguments are in square brackets?

当我阅读文档时,我不明白方括号中的函数参数是什么意思。

以OpenCV的GaussianBlur函数为例:

cv2.GaussianBlur(src, ksize, sigmaX[, dst[, sigmaY[, borderType]]]) → dst

sigmaX后面的方括号是什么意思?

表示可选参数。

它不是python特定语法,它是更通用的语法符号语法,例如来自https://en.wikipedia.org/wiki/Extended_Backus–Naur_form:

Many BNF specifications found online today are intended to be human-readable and are non-formal. These often include many of the following syntax rules and extensions:

Optional items enclosed in square brackets: [].

https://en.wikipedia.org/wiki/Extended_Backus–Naur_formBasics 章节中有更好的解释。