Out of curiosity: Does anyone know why the code below is valid in python3, but
not python2:
def foo(*args, bar=1, **kwargs):
pass
--
Maciej Dziardziel
--
http://mail.python.org/mailman/listinfo/python-list
On 4/07/2013 1:52 PM, Maciej Dziardziel wrote:
Out of curiosity: Does anyone know why the code below is valid in python3, but
not python2:
def foo(*args, bar=1, **kwargs):
pass
It was an explicit syntax change for Python3. You can read about the
reasoning behind it here:
On Thu, Jul 4, 2013 at 1:52 PM, Maciej Dziardziel fied...@gmail.com wrote:
Out of curiosity: Does anyone know why the code below is valid in python3,
but not python2:
def foo(*args, bar=1, **kwargs):
pass
Keyword-only arguments are (IIRC) a Py3-only feature. There are lots
of features
On 4 July 2013 04:52, Maciej Dziardziel fied...@gmail.com wrote:
Out of curiosity: Does anyone know why the code below is valid in python3,
but not python2:
def foo(*args, bar=1, **kwargs):
pass
Python 3 gained syntax for keyword-only arguments.
Try foo(1) and it will fail -- bar needs
On Thursday, July 4, 2013 5:05:23 AM UTC+1, alex23 wrote:
It was an explicit syntax change for Python3. You can read about the
reasoning behind it here:
http://www.python.org/dev/peps/pep-3102/
Thanks, that was helpful.
Maciej Dziardziel
--
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
On 4 July 2013 05:47, alex23 wuwe...@gmail.com wrote:
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,