On Mon, Oct 24, 2011 at 3:03 AM, Chris Angelico <ros...@gmail.com> wrote:

> On Mon, Oct 24, 2011 at 4:18 PM, Jason Swails <jason.swa...@gmail.com>
> wrote:
> > my_csv = csv.writer(open('temp.1.csv', 'wb'))
> >
>
> Have you confirmed, or can you confirm, whether or not the file gets
> closed automatically when the writer gets destructed? If so, all you
> need to do is:
>
> my_csv = something_else
> # or:
> del my_csv
>

I'm not sure why I decided against this approach in the first place.  This
does work (at least with my test), so it's what I'll do.  I probably wasn't
confident that it would clean itself up properly, but that's probably rather
un-pythonic and would not have made it into the stdlib if that was the case.

Thanks!
Jason
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to