I am able to do this:
{'class': 'foo'}
But when I do this:
dict(class='foo')
I get:
File "<stdin>", line 1
{'class':}
^
SyntaxError: invalid syntax
Why can’t python use ‘class’ as a **kwarg? It can just as easily use list, int, len… as keyword arguments.
list,int, andlenare not keywords, they are normal identifiers.classis a keyword.