Use "six" to abstract dictionary iteration and callable for python 2/3

Review Request #4895 — Created Nov. 4, 2013 and submitted

Information

Review Board
master

Reviewers

Use "six" to abstract dictionary iteration and callable for python 2/3

I'm starting to work on porting our codebase to be compatible with both python
2 and 3. In python 3, items(), keys(), and values() are all iterators by
default and the old iter*() methods are gone. The "six" library includes
abstractions to handle these.

In addition, for some strange reason 'callable' is gone in python 3.0 and 3.1.
They brought it back in 3.2 (which may be a reasonable minimum), but for now,
to get the 2to3 tool to shut up, I'm using six's abstraction for that as well.

Ran unit tests.

Description From Last Updated

I think len() will still do the right thing here, without converting to a list.

chipx86chipx86

Same comment about len().

chipx86chipx86

Is this still needed?

chipx86chipx86
david
chipx86
  1. 
      
  2. Show all issues

    I think len() will still do the right thing here, without converting to a list.

    1. In fact, we don't even need to call .keys(), because len works on mappings.

  3. Show all issues

    Same comment about len().

  4. setup.py (Diff revision 2)
     
     
    Show all issues

    Is this still needed?

  5. 
      
david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed