On 4/07/2013 2:12 PM, Joshua Landau wrote:
On 4 July 2013 04:52, Maciej Dziardziel <fied...@gmail.com> wrote:
def foo(*args, bar=1, **kwargs):
pass
Try "foo(1)" and it will fail -- "bar" needs to be given as a keyword.
No it won't, because it is supplied with a default. You may be
confusing it with the requirement that `bar` must be given as a keyword
in order for it to override the default, compared to the way this would
need to be written in Py2:
def foo(bar=1, *args, **kwargs):
...
...in which case `bar` could be assigned to by the first positional
argument.
--
http://mail.python.org/mailman/listinfo/python-list