[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal: Function Definition Named/Default Argument Syntax Sugar
- From: Chris Emerson <chris-lua@...>
- Date: Thu, 14 Jun 2012 10:25:14 +0100
On Wed, Jun 13, 2012 at 07:39:40PM +0200, Dirk Laurie wrote:
> There is also the possibility of a mixture. For example, only today
> I wrote a function that can be called this way:
>
> subst { expr, x=1, y=2, z=3 }
>
> The great thing about the fact that this is legal in Lua is that the
> number and the names of the extra parameters may vary. It's way more
> powerful than the named parameters of Python etc, in which the names
> have to be predictable.
A bit off-topic, but you can do extra named parameters in Python too with
**kwargs.
Regards,
Chris