4 ms·
I hope you didn't say it's fun id(x): x; Well, I did. :) That's an interesting example. My first reaction was that one might be able to construct a similar an
by gruseom 13y ago
I hope you didn't say it's fun id(x): x;
Well, I did. :)
That's an interesting example. My first reaction was that one might be able to construct a similar anomaly by abusing optional arguments, but perhaps not: optional arguments to F don't get magically passed on to G. Still, I feel like I've seen function-signature constructs that would break the identity function similarly to how multiple-return does in your example. Maybe some twisted aspect of Common Lisp...
- skrishnamurthi 13y agoNo doubt. Things with optional arguments, keyword arguments, all sorts of contraptions like that. That's why we've studiously avoided such things. Still, there's an asymmetry, at least to our minds, between calls and returns, so the argument put forth for multiple values ("a function can take multiple arguments, why can't it return multiple answers?" -- made especially compelling in a CPS context, because returns turn into calls) doesn't quite play out in practice. Ergo, no multiple return values.
- skrishnamurthi 13y agoPS: Fun exchange for me, too!