On 4 Feb 2003 at 16:45, Moore, Paul wrote: > My actual preference is for a lock object with enter = acquire and > leave = release. Then, the idiom is > > with my_lock: > # protected code > > This requires a separate enter hook. As opposed to: with lock(my_lock): # protected code which wouldn't. I prefer the second, but I'm not entirely sure why. I think, maybe, it's because the parentheses in the second one tell me we are actually doing something, whereas the first one looks like a variable access which is the one thing that can't actually have side effects. It's probably just that I've been playing with C# too much recently (where the 'using' statement requires you to create an object). :-( -- Duncan Booth duncan@dales.rmplc.co.uk int month(char *p){return(124864/((p[0]+p[1]- p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? http://dales.rmplc.co.uk/Duncan
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