Steven D'Aprano wrote:
On Fri, 15 May 2009 08:26:30 pm Nick Coghlan wrote:
Some years ago, Python overloaded the binary operators * and ** for use as special markers in parameter lists. I suggest we could do the same, by overloading the & operator in a similar fashion: inside the parameter list, &x would mean to delay evaluation of the default argument: [...] Marking the parameter name strikes me as wrong anyway - it's only the evaluation of the default argument which is special, not the
Steven D'Aprano wrote: parameter itself.
But it is the parameter that is special. The default object itself is not.
It's not the object that is being marked as special: it's the expression to create the object. The new syntax is about delaying evaluation of that expression - the parameter itself is perfectly normal, as is the object that is ultimately bound to it. But moving the default argument evaluation to call time instead of definition time - that's special. It may be worth using something like "make_default()" in examples instead of "[]" and see if that makes my point any clearer. I doubt it's possible to come up with a concise syntax for this (particularly one that plays well with function annotations), but best of luck in the search :) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia ---------------------------------------------------------------