@StanFromIreland noticed in the review of GH-155513 that the parameter names in the time module documentation differ from the names used in the docstrings.
| function |
Doc/library/time.rst |
docstring |
asctime |
asctime([t]) |
asctime([tuple]) |
ctime |
ctime([secs]) |
ctime(seconds) |
gmtime |
gmtime([secs]) |
gmtime([seconds]) |
localtime |
localtime([secs]) |
localtime([seconds]) |
mktime |
mktime(t) |
mktime(tuple) |
sleep |
sleep(secs) |
sleep(seconds) |
strftime |
strftime(format[, t]) |
strftime(format[, tuple]) |
All these parameters are positional-only, so the names are not part of the API, but they should not contradict each other.
After GH-155513 they are no longer just a text in the docstring: asctime, ctime, gmtime, localtime and mktime get a real signature, and the METH_O mktime and sleep no longer report the generic ($self, object, /). time_tuple is used there instead of tuple, which shadows a builtin.
There are also two inconsistencies inside the docstrings themselves: the seconds argument of ctime is optional, and the format argument of strptime is optional (it defaults to "%a %b %d %H:%M:%S %Y"), but neither is shown in brackets.
Linked PRs
@StanFromIreland noticed in the review of GH-155513 that the parameter names in the
timemodule documentation differ from the names used in the docstrings.Doc/library/time.rstasctimeasctime([t])asctime([tuple])ctimectime([secs])ctime(seconds)gmtimegmtime([secs])gmtime([seconds])localtimelocaltime([secs])localtime([seconds])mktimemktime(t)mktime(tuple)sleepsleep(secs)sleep(seconds)strftimestrftime(format[, t])strftime(format[, tuple])All these parameters are positional-only, so the names are not part of the API, but they should not contradict each other.
After GH-155513 they are no longer just a text in the docstring:
asctime,ctime,gmtime,localtimeandmktimeget a real signature, and the METH_Omktimeandsleepno longer report the generic($self, object, /).time_tupleis used there instead oftuple, which shadows a builtin.There are also two inconsistencies inside the docstrings themselves: the seconds argument of
ctimeis optional, and the format argument ofstrptimeis optional (it defaults to"%a %b %d %H:%M:%S %Y"), but neither is shown in brackets.Linked PRs