On Fri, 29 Oct 2021 at 11:10, Steven D'Aprano
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.