TroyGrosfield.com TroyGrosfield.com

Posts Tagged ‘design_patterns’

Headline

Python Context Manager and the With Statement

Author
by Troy Grosfield
Date
October 11th, 2010
Category
Developer
Story

Context managers are a great way to “loan” out objects. In conjunction with python’s “with” statement, this can be quite the powerful design pattern. You will see ways to automatically clean up entire objects or parts of objects once they are no longer needed. Below we create an object to be used temporarily, “loan” it … read more

Tags
Comments
No Comments »