The first version is preferable:
{1: 'one', 2: 'two'}
. The second variant only works for (some) string keys. Using different kinds of syntax depending on the type of the keys would be an unnecessary inconsistency.It is faster:
$ python -m timeit "dict(a='value', another='value')"
1000000 loops, best of 3: 0.79 usec per loop
$ python -m timeit "{'a': 'value','another': 'value'}"
1000000 loops, best of 3: 0.305 usec per loop