Dave Angel <da...@davea.name>: > Why would you prefer that over a generator function, as given earlier > in the thread? See for example Ned's message. By using 'yield', you > get Python to generate all the class boilerplate for you.
I think the OP can learn from the comparison. One question, many lessons: * Here's how you write a generator. * Here's how you write a context manager class. You run into those quite often as well. * See how much more suitable a generator is in this case. No need to shoot down those who only try to be helpful. Marko -- https://mail.python.org/mailman/listinfo/python-list