News for hackers. Stuff that matters.
Re: (Python) Generator Tricks For Systems Programmer (pdf) by rmc on Wednesday December 14, 2011 @07:01AM (#3351507)
Looks like you could benefit from python's context managers (aka the "with" statement http://www.python.org/dev/peps/pep-0343/ ). It allows you to do something at the start, do stuff in the middle, then guantee that something is done at the end, even if an exception is thrown. things that need to be closed afterwards are a great example of where with statements help.
Re: (Python) Generator Tricks For Systems Programmer (pdf) by jbm on Wednesday December 14, 2011 @10:15AM (#3352091)
Thanks, I'll take a look.