From that description, the right approach sounds to me that your new PatternGenerator should raise an exception when it runs out of patterns, and the GeneratorSheet should then catch the exception and print the warning as your current code does.  That should have the same behavior as your pull request for your use case.  And it has the major advantage that if anyone else ever uses a PatternGenerator in a case where it might run out of patterns and the surrounding code isn't anticipating that, an exception will be raised.  You've already discovered how dangerous it is to have None returned silently, so let's make sure that never happens again!  Sound ok?



-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.