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

Chris Angelico rosuav at gmail.com
Thu Jul 4 00:10:39 EDT 2013


On Thu, Jul 4, 2013 at 1:52 PM, Maciej Dziardziel <fiedzia at 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 that don't work in Python 2 - that's simply the way things
happen with old versions of software.

ChrisA



More information about the Python-list mailing list