On 4 August 2016 at 00:24, Alexander Belopolsky <alexander.belopolsky at gmail.com> wrote: > On Fri, Jul 29, 2016 at 12:55 PM, Alexander Belopolsky > <alexander.belopolsky at gmail.com> wrote: >> >> How should I present the signature of the new replace method in the >> documentation? > > Having not seeing any replies, let me make a proposal: > > datetime.replace(hour=self.hour, minute=self.minute, second=self.second, > microsecond=self.microsecond, tzinfo=self.tzinfo, *, fold=self.fold) > > while not a valid method signature, this seems to correctly reflect > what replace() does. Does that mean replace() accepts most of its arguments as either positional or keyword arguments? IMO when the documentation uses the “name=default” notation, it implies keyword argument support, while the [name] notation implies only supporting a positional argument. If replace() actually supported these keywords all along, then I am happy with this proposal. There are a few bug reports that may be relevant: https://bugs.python.org/issue13386: notation where there is no simple default value https://bugs.python.org/issue23738: notation for defaults for positional-only parameters
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