Siv Scripts

Solving Problems Using Code


Wed 17 May 2017

A Gentle Introduction to Context Managers: The Pythonic Way of Managing Resources

Posted by Aly Sivji in Tutorials   

Summary

  • Explore with statements and the context manager protocol
  • Implement context manager class to query MongoDB
  • Convert try...finally block to with block and increase code readability

I recently read Steve McConnell's Code Complete to level up my software development skill-set. The book has helped me become more deliberate about programming and problem solving in general. Before I sit down to write a single line of code, I take some time to plan out the work I am going to do versus code by the seat of my pants

Read more...