Back Under The Hood Again
Here's the backtracking implementation of AndP:
class And2P (Pattern):
def Match (self, subject):
for result1 in self.pat1.Match (subject):
for result2 in self.pat2.Match (subject):
yield None
def __init__ (self, pat1, pat2):
self.pat1 = pat1
self.pat2 = pat2
(This is a special-case implementation of the bactracking AndP that's used by the "&" operator.)