[Python-Dev] performance of {} versus dict()
Serhiy Storchaka
storchaka at gmail.com
Wed Nov 14 17:23:16 CET 2012
On 14.11.12 11:12, Chris Withers wrote:
> ....which made me a little sad, I suspect I'm not the only one who finds:
>
> a_dict = dict(
> x = 1,
> y = 2,
> z = 3,
> ...
> )
>
> ....easier to read than:
>
> a_dict = {
> 'x':1,
> 'y':2,
> 'z':3,
> ...
> }
PEP 8 recommends:
a_dict = dict(
x=1,
y=2,
z=3,
...
)
and
a_dict = {
'x': 1,
'y': 2,
'z': 3,
...
}
More information about the Python-Dev
mailing list