2 ms·
I mean "with" for opens and the like, not structures. Python "with", not Pascal "with". For Python's "with", someone figured out what to do if something goes w
by Animats 11y ago
I mean "with" for opens and the like, not structures. Python "with", not Pascal "with".
For Python's "with", someone figured out what to do if something goes wrong in __exit__, which is called as control leaves the with clause. An exception in an __exit__ is handled well, and nested exceptions work reasonably. Failure to get this right results in problems such as unnoticed truncated files because the status on the close after a write wasn't checked.
- pcwalton 11y agoRight, I'm referring to Python's "with". How do you write reference counted smart pointers without RAII?