The square brackets […]
is a common metalanguage notation used to denote an optional component of a syntax in documentation and manuals. "Optional" here means you can either omit or keep everything inside the brackets (but not a subset of it). It is in some sense analogous to (…)?
in regular expressions.
The usage predates Python: you can find it in various Unix manpages. It is not part of Python's syntax, though you will find it in many docs.
When the documentation says:
foo(x[, y])
Formally, it means that both of the following are acceptable:
foo(x)
foo(x, y)
For your example:
json.load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]])
Formally, it means any of the following are acceptable:
json.load(fp)
json.load(fp, encoding)
json.load(fp, encoding, cls)
json.load(fp, encoding, cls, object_hook)
json.load(fp, encoding, cls, object_hook, parse_float)
json.load(fp, encoding, cls, object_hook, parse_float, parse_int)
json.load(fp, encoding, cls, object_hook, parse_float, parse_int, parse_constant)
json.load(fp, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook)
json.load(fp, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
However, the documentation is not very precise with the notation: it's fine to use keyword arguments to skip any of the parameters that you don't care because of the way arguments in Python work, e.g.:
json.load(fp, parse_float=3)
In fact, if you look at the same documentation for Python 3 you see that they chose to use a much clearer notation:
json.loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)