Gareth McCaughan <gmccaughan@synaptics-uk.com>: > with LHS=EXPR: > BODY > > is the same as > > TEMPNAME=EXPR > LHS=TEMPNAME.begin() > try: > BODY > finally: > TEMPNAME.end() I like the simplicity of this as compared to the "under" proposal. Here's an even simpler version: with LHS = EXPR: BODY is equivalent to LHS = EXPR try: BODY finally: del LHS with TEMPNAME substituted for LHS if the latter is is omitted. As a bonus, this would double as a means of introducing a local name with restricted scope. In fact, you could turn it around and describe it as a facility for introducing local names with restricted scope, with one application of using it as a resource-acquisition control structure. Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
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