![](https://secure.gravatar.com/avatar/7b64a7b614bc54cd61fbc4e89349152a.jpg?s=120&d=mm&r=g)
I don't really disagree with most of what you wrote! And agree that decorators, specifically, are a pretty good solution within the scope of an individual package. But I would quibble with this:
How fundamental is it that THIS function is a generator, rather than simply that it returns an iterator (or that it returns a generator/coroutine object, etc)?
The delayed execution of a generator function is, IMO very, very different than a regular function! ``` def f(): result = side_effect1() yield 0 yield 1 return result ``` vs. ``` def f(): side_effect() return range(2) ``` These are contrived examples, obviously, but I've specifically encountered issues like this when working with code that handles streaming data - from a db or REST API, for instance. My experience of this type of code is often along the following lines: ``` def stream_rows(self): [mutex handling ...] [retry logic] [more mutexes?] [some timeout stuff] [...] ``` I don't mean to belabor the point - the decision in PEP 255 is pretty definitive, and this was more or less a "modest proposal" anyway. I do appreciate the responses and discussion! Thanks, Aaron