Re: Re: [RFC] Named parameters

From: Date: Wed, 11 Sep 2013 14:12:48 +0000
Subject: Re: Re: [RFC] Named parameters
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 11/09/2013 13:16, [email protected] wrote:
I'm still undecided about 'mixing' positional & named arguments: An example use case for **kwargs here: http://www.python-requests.org/en/latest/api/ If you declare: request($method, $url, ...$args) Would $args collect 'method' and 'url' ? request(method => 'post', url => 'foo/'); No. With positional arguments:
    function foo($bar, $foobar, ...$x) {}
    foo(1, 2);
Then $x will be empty, since it only collects "left-over" arguments, I suppose. The same applies for named arguments. In the case you used, $args would be empty, as $method and $url pick up those named arguments. ---- Andrea Faulds http://ajf.me/

Thread (46 messages)

« previous php.internals (#69010) next »