← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1556379] [NEW] dict.keys() compatibility in Python 2 and 3

 

Public bug reported:

In Python 2, dict.keys() will return a list. But in Python 3, it will
return an iterable. So we need to fix all the assumptions that assuming
dict.keys() is a list. They may be:

1. A function's return value which is expected to be a list
2. Anywhere dict.keys() is used as a list

We don't need to fix:

1. for xxx in dict.keys:
2. if dict.keys():
3. dict.keys() as a parameter of set.difference(), filter(), and so on.
4. Anywhere dict.keys() has been transformed to a set, or any other iterable.

** Affects: neutron
     Importance: Undecided
     Assignee: Tang Chen (tangchen)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Tang Chen (tangchen)

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

Title:
  dict.keys() compatibility in Python 2 and 3

Status in neutron:
  New

Bug description:
  In Python 2, dict.keys() will return a list. But in Python 3, it will
  return an iterable. So we need to fix all the assumptions that
  assuming dict.keys() is a list. They may be:

  1. A function's return value which is expected to be a list
  2. Anywhere dict.keys() is used as a list

  We don't need to fix:

  1. for xxx in dict.keys:
  2. if dict.keys():
  3. dict.keys() as a parameter of set.difference(), filter(), and so on.
  4. Anywhere dict.keys() has been transformed to a set, or any other iterable.

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


Follow ups