An easy optimization is to use sets instead of lists for the open and closed sets.
openSet = set()
closedSet = set()
This will make all of the in and not in tests O(1) instead of O(n).
An easy optimization is to use sets instead of lists for the open and closed sets.
openSet = set()
closedSet = set()
This will make all of the in and not in tests O(1) instead of O(n).