[Nick] > I also added a new question to the Wiki regarding what, if any, > guarantees will be made regarding when (or if) asynchronous interrupts > will be blocked. Given that the call to __enter__() can invoke > arbitrary Python code, is pushing the with statement setup inside a > single opcode actually sufficient?
Not sufficient if __enter__ is written in Python; in that case, *nothing* can be done to make it sufficient. The single opcode makes it possible to implement __enter__ in C to solve the issue in specific cases. > It also considers the possibility of using with statements in an RAII > style by acquiring the resource in __init__ or __new__ rather than > __enter__. Python isn't C++; you shouldn't do that. > This is a topic that got a brief mention during early discussion here, > but doesn't seem to be covered in the current version of PEP 343. I haven't been infected with the RAII meme, so I can't help you here. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com