What is the preferred syntax for initializing a dict?
- by daotoad
I'm putting in some effort to learn Python, and I am paying close attention to common coding standards. This may seem like a pointlessly nit-picky question, but I am trying to focus on best-practices as I learn, so I don't have to unlearn any 'bad' habits.
I see two common methods for initializing a dict:
a = {
'a': 'value',
'another': 'value',
}
b = dict(
a='value',
another='value',
)
Which is considered to be "more pythonic"? Which do you use? Why?