On Sun, Oct 31, 2021 at 9:20 AM Paul Moore <[email protected]> wrote: > > On Sat, 30 Oct 2021 at 23:13, Brendan Barnwell <[email protected]> wrote: > > > > On 2021-10-30 15:07, David Mertz, Ph.D. wrote: > > > I'm -100 now on "deferred evaluation, but contorted to be useless > > > outside of argument declarations." > > > > > > At first I thought it might be harmless, but nothing I really care > > > about. After the discussion, I think the PEP would be actively harmful > > > to future Python features. > > > > I'm not sure I'm -100, but still a hard -1, maybe -10. > > > > I agree it seems totally absurd to add a type of deferred expression > > but restrict it to only work inside function definitions. That doesn't > > make any sense. If we have a way to create deferred expressions we > > should try to make them more generally usable. > > I was in favour of the idea, but having seen the implications I'm now > -0.5, moving towards -1. I'm uncomfortable with *not* having a > "proper" mechanism for building signature objects and other > introspection (I don't consider having the expression as a string and > requiring consumers to eval it, to be "proper"). And so, I think the > implication is that this feature would need some sort of real deferred > expression to work properly - and I'd rather deferred expressions were > defined as a standalone mechanism, where the full range of use cases > (including, but not limited to, late-bound defaults!) can be > considered. >
Bear in mind that the status quo is, quite honestly, a form of white lie. In the example of bisect: def bisect(a, hi=None): ... def bisect(a, hi=>len(a)): ... neither form of the signature will actually say that the default value is the length of a. In fact, I have never said that the consumer should eval it. There is fundamentally no way to determine the true default value for hi without first figuring out what a is. So which is better: to have the value None, or to have a marker saying "this will be calculated later, and here's a human-readable description: len(a)"? I know that status quo wins a stalemate, but you're holding the new feature to a FAR higher bar than current idioms. ChrisA _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/5VREGOCSY7N6APQJUDYQ5QVOYKMS6R2R/ Code of Conduct: http://python.org/psf/codeofconduct/
