Re: Why this code works in python3, but not python 2:

2013-07-03 Thread Joshua Landau
On 4 July 2013 05:47, alex23 wrote: > On 4/07/2013 2:12 PM, Joshua Landau wrote: >> >> On 4 July 2013 04:52, Maciej Dziardziel 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

Re: Why this code works in python3, but not python 2:

2013-07-03 Thread alex23
On 4/07/2013 2:12 PM, Joshua Landau wrote: On 4 July 2013 04:52, Maciej Dziardziel 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 r

Re: Why this code works in python3, but not python 2:

2013-07-03 Thread Maciej Dziardziel
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 -- http://mail.python.org/mailman/listinfo/python

Re: Why this code works in python3, but not python 2:

2013-07-03 Thread Joshua Landau
On 4 July 2013 04:52, 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 Python 3 gained syntax for keyword-only arguments. Try "foo(1)" and it will fail -- "bar" needs to be gi

Re: Why this code works in python3, but not python 2:

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 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 Keyword-only arguments are (IIRC) a Py3-only feature. There are lots of features that don't wor

Re: Why this code works in python3, but not python 2:

2013-07-03 Thread alex23
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: http://www.pyth

Why this code works in python3, but not python 2:

2013-07-03 Thread 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 -- Maciej Dziardziel -- http://mail.python.org/mailman/listinfo/python-list