Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #14934 > unrolled thread
| Started by | Andrew McLean <lists@andros.org.uk> |
|---|---|
| First post | 2011-10-24 21:35 +0100 |
| Last post | 2011-10-24 21:35 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: CSV writer question Andrew McLean <lists@andros.org.uk> - 2011-10-24 21:35 +0100
| From | Andrew McLean <lists@andros.org.uk> |
|---|---|
| Date | 2011-10-24 21:35 +0100 |
| Subject | Re: CSV writer question |
| Message-ID | <mailman.2190.1319488517.27778.python-list@python.org> |
On 24/10/2011 08:03, Chris Angelico wrote:
> On Mon, Oct 24, 2011 at 4:18 PM, Jason Swails<jason.swails@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
>
> to unbind what I assume is the only reference to the csv.writer, upon
> which it should promptly clean itself up.
My understanding is that in cpython the file does get closed when the
writer is deleted, however, it's not guaranteed to happen in other
Python implementations (e.g. IronPython, PyPy and Jython).
Andrew
Back to top | Article view | comp.lang.python
csiph-web