make generator syntax Python 3-compatible