On 5/15/05, Nick Coghlan <ncoghlan at gmail.com> wrote: > http://members.iinet.net.au/~ncoghlan/public/pep-3XX.html In reading over PEP 3XX again, it struck me that I'd been having a really hard time grasping exactly when I needed to use the "needs_finish" decorator. Am I right in saying that I should use the "needs_finish" decorator every time I have a "yield" inside a with-statement or a try/finally? Are there other situations where I might need the "needs_finish" decorator? If it's true that I need the "needs_finish" decorator every time I have a "yield" inside a with-statement or a try/finally, I'd be inclined to do this automatically. That is, since a yield inside a with-statement or try/finally can be determined lexically (heck, we do it now to disallow it), generators that have such code should be automatically wrapped with the "needs_finish" decorator, i.e. they should automatically acquire a __finish__ method. If I've misunderstood, and there are other situations when "needs_finish" is required, it'd be nice to see some more examples. STeVe -- You can wordify anything if you just verb it. --- Bucky Katt, Get Fuzzy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4