Commits

Anonymous committed 120056a

Using set rather than list for visited modules.

  • Participants
  • Parent commits 01651b2

Comments (0)

Files changed (1)

File importgraph/__init__.py

         self.graph = graph
         self.root = root
         self.ignore = ignore or set()
-        self.visited = visited or []
+        self.visited = visited or set()
         self.level = level or 1
 
     def visit_Import(self, node):
             or self.level > MAX_DEPTH):
             return
 
-        self.visited.append(module)
+        self.visited.add(module)
 
         # TODO add filtering
         display_name = module.split(".", 1)[0]