[Python-ideas] Syntax for late-binding of arguments [was: Default arguments ...]

George Sakkis george.sakkis at gmail.com
Fri May 15 17:34:54 CEST 2009


On Fri, May 15, 2009 at 10:14 AM, Jim Jewett <jimjjewett at gmail.com> wrote:

> Logically, you're correct.  But I think the ('&' ==> addressof) meme
> may have already grown too strong.  What it suggests to me is that
> normally you *would* create a new list, but the ampersand says not to
> in just this rare case.

Well the connotations are not much stronger than with '*' and '**'.
I've been literally asked by an experienced C/C++/Perl guy "what's
this pointer to a pointer parameter used for in this function ?".

How about '@' instead ? A mnemonic here could be "just like
'@decorator\ndef f():' is a shortcut for 'f = decorator(f)', the
'@arg=expr' parameter is a shortcut for 'arg = (lambda: expr)()' if
'arg' is not passed". Admittedly, far from a perfect analogy but
probably less controversial than '&'.

George



More information about the Python-ideas mailing list