Treat generator functions and objects the same