Commits

Pierre Carbonnelle  committed 10c1d37

perf : do not rebase if no parent_class

  • Participants
  • Parent commits 6367d57

Comments (0)

Files changed (1)

File pyDatalog/pyEngine.py

 def subst_in_clause(clause, env, parent_class=None):
     """ apply the env mapping and rebase to parent_class, if any """
     if not env and not parent_class: return clause
+    if not parent_class:
+        return Clause(subst(clause.head, env),
+                       [subst(bodi, env) for bodi in clause.body])
     return Clause(subst(clause.head, env).rebased(parent_class),
-                       [subst(bodi, env).rebased(parent_class) for bodi in clause.body])
+                    [subst(bodi, env).rebased(parent_class) for bodi in clause.body])
     
 def rename_clause(clause):
     """ returns the clause with fresh variables """
 
 # DATABASE  #####################################################
 
-# The database stores predicates that contain clauses.  Predicates
-# not in the database are subject to garbage collection.
+# The database stores predicates that contain clauses.  
 
 def insert(pred):
     Thread_storage.Db[pred.id] = pred