> On 1 Dec 2021, at 06:16, Chris Angelico <ros...@gmail.com> wrote:
>
> I've just updated PEP 671 https://www.python.org/dev/peps/pep-0671/
> with some additional information about the reference implementation,
> and some clarifications elsewhere.
(I suspect that there was a reply that I should be replying to but, cannot find
one appropriate)
I have a lot of code that exploits the fact that passing an explicit None will
cause the early bound default idiom to set the default for me.
def inner(timestamp=None):
if timestamp is None:
timestamp = time.time()
do_stuff...
def outer(timestamp=None):
inner(timestamp=timestamp)
outer can in an idiomatic way have inner default timestamp and not have to know
what that means.
With late bound I cannot do this without more complex pattern of building an
arg list.
What if passing None still worked? I know the argument that there are more
sentinels then None.
def inner(timestamp=>time.time())
do_stuff...
def outer(timestamp=None):
inner(timestamp=timestamp)
The code in inner that decides to when to allow the default could check for
timestamp being
missing or arg present and None.
Would the lack of support for other sentinels out weight the simple way to get
the default applied?
Barry
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/L7YDL225ETTLWAB64NJY5CJJUABUI4NB/
Code of Conduct: http://python.org/psf/codeofconduct/