From: Duncan Booth [mailto:duncan@rcp.co.uk] > Your autoclose example doesn't use __enter__, and your autolock = example=20 > would work just as well if you moved the __enter__ code into __init__=20 > (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=20 > be dropped for even more simplicity? My actual preference is for a lock object with enter =3D acquire and leave =3D release. Then, the idiom is with my_lock: # protected code This requires a separate enter hook. Paul.
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