Commit 65860700 authored by Tiago Peixoto's avatar Tiago Peixoto

Fix bug with python3 and xrange

parent 6e3cce61
......@@ -76,6 +76,9 @@ Contents
"""
from __future__ import division, absolute_import, print_function
import sys
if sys.version_info < (3,):
range = xrange
__author__ = "Tiago de Paula Peixoto <tiago@skewed.de>"
__copyright__ = "Copyright 2007-2012 Tiago de Paula Peixoto"
......@@ -1128,7 +1131,7 @@ class Graph(object):
return v
else:
pos = self.num_vertices() - n
return (self.vertex(i) for i in xrange(pos, pos + n))
return (self.vertex(i) for i in range(pos, pos + n))
def remove_vertex(self, vertex):
"""Remove a vertex from the graph."""
......
......@@ -75,13 +75,15 @@ Contents
"""
from __future__ import division, absolute_import, print_function
import sys
if sys.version_info < (3,):
range = xrange
from .. dl_import import dl_import
dl_import("from . import libgraph_tool_search")
from .. import _prop, _python_type
from .. decorators import _wraps
import sys
import weakref
__all__ = ["bfs_search", "BFSVisitor", "dfs_search", "DFSVisitor",
......@@ -1445,7 +1447,7 @@ def astar_search(g, source, weight, visitor=AStarVisitor(),
self.visited = {}
def examine_vertex(self, u):
for i in xrange(len(self.state[u])):
for i in range(len(self.state[u])):
nstate = list(self.state[u])
nstate[i] ^= 1
if tuple(nstate) in self.visited:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment