A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-July/145726.html below:

[Python-Dev] Method signatures in the datetime module documentation

[Python-Dev] Method signatures in the datetime module documentationAlexander Belopolsky alexander.belopolsky at gmail.com
Fri Jul 29 12:55:41 EDT 2016
I have started [1] writing documentation for the new PEP 495 (Local
Time Disambiguation) features and ran into the following problem.  The
current documentation is rather inconsistent in presenting the method
signatures.  For example:

date.replace(year, month, day) [2], but
datetime.replace([year[, month[, day[, hour[, minute[, second[,
microsecond[, tzinfo]]]]]]]]) [3].


The new signature for datetime.replace in the Python implementation is

def replace(self, hour=None, minute=None, second=None, microsecond=None,
            tzinfo=True, *, fold=None):


but the C implementation does not accept True for tzinfo or None for
the other arguments.  The defaults in the Python implementation are
really just sentinels to detect which arguments are not provided.

How should I present the signature of the new replace method in the
documentation?


[1]: http://bugs.python.org/issue27595
[2]: https://docs.python.org/3/library/datetime.html#datetime.date.replace
[3]: https://docs.python.org/3/library/datetime.html#datetime.datetime.replace
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4