> From: "Gerald S. Williams" <gsw@agere.com> > holger krekel wrote: > > I think we can may get away with only a "weak" keyword > > and allow the aforementioned encapsulation of execution > > events into an object like this: > > > > exec expr [with params]: suite > > I was about to propose something similar. This looks like > it can be unified with what Guido proposed. > > > regards and interested in comments, > > An observation: > > Used like this, "with" looks like an alias for "lambda" > (providing default values for all parameters). > Yes. If we have multiline lambda, we could write: def autoclose(f, action): try: action(f) finally: f.close() autoclose(open("blah.txt"), lambda f: for line in f: print line )
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