Search code examples
pythoncode-documentation

What does the brackets with comma around input arguments mean in python documentations?


What does the brackets around input arguments mean?

Consider this example:

cv.boxPoints(box[,points]) example doc link

What confuses me the most is the comma inside the bracket of the second input argument points. Why is it represented as [,points]. Any information on this would be greatly appreciated. Thanks!


Solution

  • It's a common convention in documentation to denote optional arguments with square brackets. That documentation is telling you that the second argument to boxPoints is optional. It has no syntactic meaning in Python; you can call the function with one or two arguments like normal.