On Fri, 29 Oct 2021 at 11:10, Steven D'Aprano <st...@pearwood.info> wrote: > Obviously you need a way to indicate that a value in __defaults__ should > be skipped. Here's just a sketch. Given: > > def func(a='alpha', b='beta', @c=expression, d=None) > > where only c is late bound, you could have: > > __defaults__ = ('alpha', 'beta', None, None) > __late_defaults__ = (None, None, <code for expression>, None)
Why not define an object for that? __defaults__ = ("alpha", "beta", _delayed, None) In this example I don't mean a fancy new delayed evaluation type such as has been discussed elsewhere, but just a sentinel so Python knows it has to look into __late_defaults__ at all (I'm probably missing something, and I didn't read all prior emails on this, but why wouldn't this type contain a reference to the code object directly, negating the need for __late_defaults__...?). Regards, Gerrit. _______________________________________________ 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/G4R5X7G5MFYOPJOCUWASVRLR2O7MCUL6/ Code of Conduct: http://python.org/psf/codeofconduct/