News for hackers. Stuff that matters.
Re:Stop writing classes... by tomp on Sunday March 18, 2012 @12:19PM (#3719998)
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.

Re:Stop writing classes... by pjscott on Sunday March 18, 2012 @03:44PM (#3720676)
Everything 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.