← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1849980] [NEW] Do not inherit from built-in "dict"

 

Public bug reported:

agent.linux.dhcp.DictModel inherits from built-in "dict" type. This is
not recommended because some type methods are implemented not in Python
but in C [1][2] and should not be overridden. Subclassing the built-in
types directly, will yield non-obvious errors that are hard to debug,
and identify at first glance [3].


[1] http://www.kr41.net/2016/03-23-dont_inherit_python_builtin_dict_type.html
[2] https://treyhunner.com/2019/04/why-you-shouldnt-inherit-from-list-and-dict-in-python/
[3] https://medium.com/bynder-tech/using-collections-in-python-36129737b5a1

** Affects: neutron
     Importance: Undecided
     Assignee: Rodolfo Alonso (rodolfo-alonso-hernandez)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Rodolfo Alonso (rodolfo-alonso-hernandez)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1849980

Title:
  Do not inherit from built-in "dict"

Status in neutron:
  New

Bug description:
  agent.linux.dhcp.DictModel inherits from built-in "dict" type. This is
  not recommended because some type methods are implemented not in
  Python but in C [1][2] and should not be overridden. Subclassing the
  built-in types directly, will yield non-obvious errors that are hard
  to debug, and identify at first glance [3].

  
  [1] http://www.kr41.net/2016/03-23-dont_inherit_python_builtin_dict_type.html
  [2] https://treyhunner.com/2019/04/why-you-shouldnt-inherit-from-list-and-dict-in-python/
  [3] https://medium.com/bynder-tech/using-collections-in-python-36129737b5a1

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


Follow ups