Re: PEP 671 (late-bound arg defaults), next round of discussion

I've been holding off commenting on this because frankly y'all talk a hell of a lot and I'm still about five days back trying to keep up with all the back-and-forth. So probably some of this repeats something that's been said and I apologize for that, but I did want to put my two cents' worth in.
1) If this feature existed in python as described, would you use it?
I wouldn't want to say no, in an absolute way, but right now I don't see any place where I'd want to use it in preference to the existing approach, and frankly in the code I maintain there's almost no place where it would come up.
1.5) If this feature existed in python as described, would you hate reading it and wish it never had been added?
Yeah, I think so. Code should communicate clearly, and tiny symbols with big meanings don't really fit with that. I don't say they shouldn't exist, but they should be rare, because they are hard to learn and must be memorized.
2) Is the distinction between "=" and "=>" a cognitive burden?
Yeah, I think so. It forces the reader of the code to pay close attention to a tiny symbol when reading a function definition. It doesn't help that the symbol is somewhat confusing, as many have pointed out. (why is it an arrow at all? why is the arrow pointing from the signifier to the signified?)
3) What would you use it for?
The motivating use case of course is the mutable default. I feel like all of the use cases that involve referencing other arguments just get us into a bad place, where the function's logic starts expanding into the args. I really don't mind having the logic in the body of the function. That seems okay in my book.
4) Is there a small change that would repair the proposal?
I think Jonathan Goble has more or less put a finger on it: we should really be asking ourselves if there is any reason to keep early-bound defaults. If there's a hunger for late-bound defaults, and if this really solves a thing, then let's make it a breaking change and plan it that way. This in fact was my first reaction when I read the PEP, and so far nothing that's been posted has made me change my view. (perhaps something posted in the last five days will convince me, though :) ) Best, -jpk
participants (1)
-
Jon Kiparsky