WIP: Change control flow as suggested by @pv.

This addresses the following comments:
https://github.com/numpy/numpy/pull/3524#discussion-diff-5665109
https://github.com/numpy/numpy/pull/3524#discussion-diff-5665218