3 ms·
I a way, you could think of the generator function as an object with a specific interface. In fact, I think that's how generators are implemented in python, th
by tomp 15y ago
I a way, you could think of the generator function as an object with a specific interface.
In fact, I think that's how generators are implemented in python, the language just hides this fact away from the programmer.
- pjscott 15y agoEverything in Python is an object under the scenes. If you look at the CPython extension API, it turns out that pretty much everything is a PyObject.