I'm a beginner at Python.
I don't understand the Python function description.
For example, the function getopt
getopt.getopt(args, options[, long_options])
what does options[, long_options] mean?
It means that the part in square brackets is optional.
From http://docs.python.org/2/library/getopt.html:
long_options, if specified, must be a list of strings ...
In case you add this optional parameter, you also need to add the comma - if you do not add it, you also must not add the comma.
This notation is, BTW, a usual convention when specifying parameters, e.g. also for command line parameters which can be passed to a unix shell command.
, and a space ` ` before long_options, are only needed if long_options are given.You would be well served to learn about EBNF syntax, which is a way to specify syntax for various languages or commands in a formal way. While many tools' syntax documentations dont use strict EBNF, they often borrow its symbols. E.g. square brackets mean an optional component. The comma formally means concatenation, and is often used to imply optional multiple repetition of symbols in the context of square brackets.
Usage Notation
definition =
concatenation ,
termination ;
alternation |
option [ ... ]
repetition { ... }
grouping ( ... )
terminal string " ... "
terminal string ' ... '
comment (* ... *)
special sequence ? ... ?
exception -
Some tools/documentation will also borrow from BNF syntax which uses a lot of angle brackets < ... > to specify symbols in terms of expressions.
For command line options the regular options are things like -h while the long option is --help. They mean the same thing and have the same effect but the short version is preceded by a single hyphen rather than two.
As has been noted in the other answers, in this case the options are required but the long_options are not which is why they are in square brackets.