What is the preferred syntax for initializing a dict?
        Posted  
        
            by daotoad
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by daotoad
        
        
        
        Published on 2010-05-17T23:37:08Z
        Indexed on 
            2010/05/17
            23:40 UTC
        
        
        Read the original article
        Hit count: 218
        
python
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?
© Stack Overflow or respective owner