I want to specify a timeout parameter for urllib.request.urlopen in python 3.
The docs say:
urllib.request.urlopen(url, data=None, [timeout, ]*, cafile=None, capath=None, cadefault=False, context=None)
What does [timeout, ]*
mean?
I thought that all optional, named arguments (data=None
, cafile=None
...) had to appear before all un-named arguments.
It looks here like timeout
is an un-named argument. But it appears after data
.
Looking just at that documentation, I have no idea whether to use:
urlopen(url, 123)
urlopen(url, timeout=123)
urlopen(url, [123])
urlopen(url, [123]*)
I can see from this post that the correct answer is urlopen(url, timeout=123)
.
But if that's the case, why do the docs say [timeout, ]*
, why not just timeout=None
?