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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With