If one browses through the official Python docs, one can see function (or class) signatures of varying kinds.
For example
random.uniform(a, b)
is simple to understand: You pass it two objects a
and b
(that are floating point numbers and it returns a random number from the interval between them). Similarly simple to understand is the signature from
SSLSocket.getpeercert(binary_form=False)
where a default value for the argument is also specified, in case it's called without any argument.
But then there are also functions with really weird signatures like
min(iterable, *[, key, default])
readline.append_history_file(nelements[, filename])
csv.register_dialect(name[, dialect[, **fmtparams]])
What do these all mean? Is there some reference guide explaining how to read things like name[, dialect[, **fmtparams]]
?
These example were just randomly taken from the official Python docs and don't cover all signature types I've come across. I need a general explanation how to read these signatures.