← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1405772] [NEW] Don't use dict constructor with a sequence of length-2 sequences

 

Public bug reported:

EP-0274 introduced dict comprehensions to replace dict constructor
with a sequence of length-2 sequences, these are benefits copied
from [1]:
  The dictionary constructor approach has two distinct disadvantages
  from the proposed syntax though.  First, it isn't as legible as a
  dict comprehension.  Second, it forces the programmer to create an
  in-core list object first, which could be expensive.
There is deep dive about PEP-0274[2] and basic tests about
performance[3].

[1]http://legacy.python.org/dev/peps/pep-0274/
[2]http://doughellmann.com/2012/11/12/the-performance-impact-of-using-dict-instead-of-in-cpython-2-7-2.html
[3]http://paste.openstack.org/show/154798/

** Affects: nova
     Importance: Undecided
     Assignee: ChangBo Guo(gcb) (glongwave)
         Status: In Progress

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1405772

Title:
  Don't use dict constructor with a sequence of length-2 sequences

Status in OpenStack Compute (Nova):
  In Progress

Bug description:
  EP-0274 introduced dict comprehensions to replace dict constructor
  with a sequence of length-2 sequences, these are benefits copied
  from [1]:
    The dictionary constructor approach has two distinct disadvantages
    from the proposed syntax though.  First, it isn't as legible as a
    dict comprehension.  Second, it forces the programmer to create an
    in-core list object first, which could be expensive.
  There is deep dive about PEP-0274[2] and basic tests about
  performance[3].

  [1]http://legacy.python.org/dev/peps/pep-0274/
  [2]http://doughellmann.com/2012/11/12/the-performance-impact-of-using-dict-instead-of-in-cpython-2-7-2.html
  [3]http://paste.openstack.org/show/154798/

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1405772/+subscriptions


Follow ups

References