From: "Moore, Paul" <Paul.Moore at atosorigin.com> > From: Oliver Schoenborn > > surprised there hasn't been more given how fundamental the problem > > of RAII is in Python. > > It's not at all clear that there *is* a "problem of RAII" in Python. > Regardless, you may want to look at PEP 310, and the (extensive) > threads on python-dev which it spawned, for an alternative view of > the issue. Already have. As mentioned in a discussion off list, I quite like 310. However, I also troweled the python-dev archives and didn't seen any discussion of anything related to the try/finally wrapping that I mentioned, and since the implementation could likely be cleaner and more performant if implemented in the interpreter directly, and would not require change to the language itself, I mentioned it here. But that's the only reason for coming to python-dev. > To summarise, I think you > should consider whether PEP 310 is what you need 310 is a good, fairly clean compromise. > (it's probably mode > Pythonic than overloading __del__ the way C++ does) I agree, that's certainly *not* what I would advocate. But since you bring it up, is there any reason why a new method like, say, __deterministic__, couldn't be added, and any class that has it means that interpreter calls that method upon scope exit if exception has been thrown *or* object unreachable? Oliver
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