I am travelling so access is limited for a week or so. What do you suggeat
the raised exception to be?
On May 28, 2013 4:18 PM, "James A. Bednar" <notifications@github.com> wrote:

> In topo/misc/generatorsheet.py:
>
> > @@ -97,7 +97,15 @@ def generate(self):
> >          # JABALERT: What does the [:] achieve here?  Copying the
> >          # values, instead of the pointer to the array?  Is that
> >          # guaranteed?
> > -        self.activity[:] = self.input_generator()
> > +        ac = self.input_generator()
> > +        if ac is not None:
> > +            self.activity[:] = ac
> > +        else:
> > +            # Note that a generator may return a None if it has run out of patterns it is loading.
>
> 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?
> … <#13eeccb1a72af774_>
> -- The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/ioam/topographica/pull/516/files#r4421744>
> .
>