Skip to content

Harmonize parameter names in the time module documentation and docstrings #155787

Description

@serhiy-storchaka

@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

Metadata

Metadata

Labels

docsDocumentation in the Doc dir

Projects

Status
Done
Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions