Tim Peters <tim.one@comcast.net>: > Maybe Guido can introduce a canned "withlock" macro just > for that <ahem>: > > withlock lock: > do stuff Daniel Mahler <mahler@cyc.com>: > There are many APIs that lead you to write code with certain fixed > parts > ... > I think the thing worth noting here is that the introduced > constructs would usually be colon&indent type entities I've been trying to think of a Pythonic syntax for passing code blocks to procedures. The best thing I've come up with so far is something like lock.do: something() which would be (sort of) equivalent to def thunk(): do_something() lock.do(thunk) except that the thunk would have to have write access to the namespace it's embedded in, perhaps implemented by sharing the stack frame. 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