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 later.

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?

7 Answers
7

Leave a Reply

Your email address will not be published. Required fields are marked *