Some my_dict.keys()  -->  list(my_dict.keys()) etc changes.

This is a harmless change under Python 2 (with a
small performace hit) but means the code does not
need alteration under Python 3.

These changes were suggested by the 2to3 dict fixer
but manually reviewed.
Some my_dict.keys()  -->  list(my_dict.keys()) etc changes.

This is a harmless change under Python 2 (with a
small performace hit) but means the code does not
need alteration under Python 3.

These changes were suggested by the 2to3 dict fixer
but manually reviewed.
Use Python 3 like dictionary as model for indexing files
Replace .iteritems() with .iter() and .itervalues() with .values()

This makes the code work as-is on Python 3 without needing
the 2to3 dict fixer, which is good.

On the downside, it means using lists under Python 2 in some
situations where it would be more memory efficient not to.

Note I also checked there were no remaining uses of .iterkeys()
which is generally pointless as can iterate over a dict directly.

    import os
    import commands
    def clean(filename):
        with open(filename, "rU") as h:
            lines = list(h)
        fix = False
        for line in lines:
            if ".iterkeys()" in line:
                print(line)
                print(filename)
                import sys
                sys.exit(1)
            if ".iteritems()" in line \
            or ".iterkeys()" in line \
            or ".itervalues()" in line:
                fix = True
                break
        if not fix:
            return False
        with open(filename, "w") as h:
            for line in lines:
                line = line.replace(".iteritems()", ".items()")
                line = line.replace(".iterkeys()", ".keys()")
                line = line.replace(".itervalues()", ".values()")
                h.write(line)
        return True

    good = 0
    bad = 0
    bad_list = open("iter_2to3.txt", "w")
    for dirpath, dirnames, filenames in os.walk("."):
        if dirpath.startswith("./build"):
            continue
        if dirpath == "." or dirpath.startswith("./Bio/_py3k"):
            continue
        for f in sorted(filenames):
            if not f.endswith(".py"):
                continue
            if f == "run_tests.py" or f == "_six.py":
                continue
            py2filename = os.path.join(dirpath, f)
            if clean(py2filename):
                bad += 1
                print(py2filename)
                bad_list.write("%s\n" % py2filename)
                os.system("git add %s" % py2filename)
            else:
                good += 1
    bad_list.close()
    print("%i no change, %i need fixers" % (good, bad))
    print("Troublesome ones %0.1f%%" % ((bad*100.0)/(good+bad)))

Conflicts:

	Bio/Data/CodonTable.py
	Bio/SeqUtils/__init__.py
Fix for editing dictionary while iterating over it
No longer need the 2to3 dict fixer (according to unit tests)

Scanning the remaining changes suggested by 2to3 -f dict by
eye they are probably all false positives (e.g. adding
list(...) where a dictionary method is used in a iterator).

Any issues with list vs iterator problems uncovered shouldn't
just be fixed without also expanding the unit test coverage.