Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #14934
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <lists@andros.org.uk> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'oct': 0.02; 'cpython': 0.05; 'pypy': 0.07; 'python': 0.08; 'ironpython,': 0.16; 'jython).': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'subject:CSV': 0.16; 'unbind': 0.16; 'mon,': 0.16; 'wrote:': 0.16; 'subject:question': 0.18; 'jason': 0.21; 'assume': 0.22; 'header:In-Reply-To:1': 0.22; 'pm,': 0.24; 'up.': 0.26; '24,': 0.29; 'writer': 0.30; '(e.g.': 0.31; 'chris': 0.32; 'andrew': 0.32; 'does': 0.32; 'to:addr :python-list': 0.33; 'however,': 0.34; 'header:User-Agent:1': 0.34; 'reference': 0.35; 'file': 0.36; 'should': 0.38; 'subject:: ': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.39; "it's": 0.40; 'closed': 0.62; 'guaranteed': 0.76; 'confirmed,': 0.84; 'or:': 0.91; 'promptly': 0.93 |
| Date | Mon, 24 Oct 2011 21:35:13 +0100 |
| From | Andrew McLean <lists@andros.org.uk> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: CSV writer question |
| References | <CAEk9e3rzxQruEO4J_xc8pxw9y4mq6QK2HK=nTX7TdECm2+T8+g@mail.gmail.com> <CAPTjJmqV34UGamM7FHcggv_yitiBvz9rroQOo-bm_1fR8LFBLQ@mail.gmail.com> |
| In-Reply-To | <CAPTjJmqV34UGamM7FHcggv_yitiBvz9rroQOo-bm_1fR8LFBLQ@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2190.1319488517.27778.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1319488517 news.xs4all.nl 6958 [2001:888:2000:d::a6]:36916 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:14934 |
Show key headers only | View raw
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: CSV writer question Andrew McLean <lists@andros.org.uk> - 2011-10-24 21:35 +0100
csiph-web