Here are some review remarks:
- Don't use else after a return in the if body. It just unnecessarily indents your code.
- if pointcache also covers if pointcache is None, so doing the former in the else clause of the latter is unnecessarily complex.
- Don't return . The function is a generator, not a regular function, so just return nothing.