On Fri, Dec 3, 2021 at 2:27 PM Steven D'Aprano <steve@pearwood.info> wrote:
On Fri, Dec 03, 2021 at 10:36:55AM +1100, Chris Angelico wrote:
Same again. If you consider the equivalent to be a line of code in the function body, then the signature has become MASSIVELY more useful. Instead of simply seeing "x=<object object at 0x7fba1b318690>", you can see "x=>[]" and be able to see what the value would be. It's primarily human-readable (although you could eval it),
You: "it is impossible to evaluate the late-bound default outside of the function!"
Also you: "Just eval the string."
You can't have it both ways :-)
I'm saying that there's a certain level of machine-readability to it, in the same way that a repr has that. You cannot, with full generality, eval a repr to get the same result; yet I don't think you'd call it a purely-human-readable representation of something. What you get in the docs for a late-bound default is more machine-readable than a repr (you could parse it to AST and expect to get the same AST that originally compiled the code), which is a far cry from "just human readable", but you can't actually eval it to reliably reconstruct the default. Please can we focus on whether the proposal is useful, and not on some throwaway comment where I took a shorthand in clarifying how something can be interpreted? No? Dangit, I must be on python-ideas :) ChrisA