Hacker News new | ask | show | jobs
by tsuraan 3080 days ago
Looks like a 2 vs 3 thing:

  Python 2.7.14 (default, Jan  6 2018, 14:37:03)
  [GCC 5.4.0] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> dict(**{1:2,3:4})
  {1: 2, 3: 4}
  >>>
vs

  Python 3.4.5 (default, Jan  6 2018, 14:44:12)
  [GCC 5.4.0] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> dict(**{1:2,3:4})
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: keyword arguments must be strings
  >>>
1 comments

This works in Python 3.6:

    >>> {**{1:2,3:4}}
    {1: 2, 3: 4}
:)