M
Maciej Dziardziel
Out of curiosity: Does anyone know why the code below is valid in python3, but not python2:
def foo(*args, bar=1, **kwargs):
pass
def foo(*args, bar=1, **kwargs):
pass
Out of curiosity: Does anyone know why the code below is valid in python3, but not python2:
def foo(*args, bar=1, **kwargs):
pass
Out of curiosity: Does anyone know why the code below is valid in python3, but not python2:
def foo(*args, bar=1, **kwargs):
pass
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:
http://www.python.org/dev/peps/pep-3102/
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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.