New to Processing but experienced in programming, especially python. I decided implementing Conway’s Game of Life would be a good project to get a feel for how to use Processing.py
My code involved a function that returned a generator for the neighbors of a given cell, yielding the coordinates for each neighboring cell as a tuple. This is quite common in python, and as far as I know has no performance issues in native python as compared with compiling a list of the neighbors and returning it.
Upon running the sketch, however, I was experiencing periodic pauses in the animation loop. I spent quite a bit of time trying to find the performance hiccup, and eventually tried changing the generator code to just construct and return a list. To my surprise, this immediately fixed the issue.
Is there something inherently inefficient about using generator functions in Processing.py (i.e. functions that yield instead of return)? Has anyone else run into a similar issue? I’m fine avoiding using yield but I would like to understand why it causes a problem.