"Moore, Paul" <Paul.Moore@atosorigin.com> wrote in news:16E1010E4581B049ABC51D4975CEDB886199D4@UKDCX001.uk.int.atosorigin.co m: > I'm rapidly tending towards a preference for extreme simplicity in the > with statement. My basic logic is that the C++ idiom for all this is > pretty minimal, and works well (even though C++ has no "finally" > equivalent, so the need is more pressing in C++). Your autoclose example doesn't use __enter__, and your autolock example would work just as well if you moved the __enter__ code into __init__ (although then you couldn't write it the alternative way you suggest). Do you have any good examples that actually require __enter__, or could it be dropped for even more simplicity? -- Duncan Booth duncan@rcp.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?
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