[Python-ideas] Syntax for late-binding of arguments [was: Default arguments ...]
CTO
debatem1 at gmail.com
Fri May 15 20:20:08 CEST 2009
On May 15, 1:26 pm, spir <denis.s... at free.fr> wrote:
> Le Sat, 16 May 2009 00:33:20 +1000,
> Nick Coghlan <ncogh... at gmail.com> s'exprima ainsi:
>
> > 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.
>
> I rather agree. Then we should mark the binding sign '=' as special (not the parameter / the object)! E.g.
>
> def f(arg &= [])
>
> or
>
> def f(arg @= [])
>
> I looks a bit strange, but we have augmented assignment already.
>
> Denis
Maybe :: ?
>>> def f(x::a**2+2*b+c):
... return x
...
>>> a, b, c = 0, 1, 2
>>> f()
4
Geremy Condra
More information about the Python-ideas
mailing list