Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52897
| Path | csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'represents': 0.05; 'subject:Python': 0.06; 'exists.': 0.07; 'expectation': 0.09; 'python': 0.11; '(file': 0.16; '23,': 0.16; 'closed.': 0.16; 'correspond.': 0.16; 'eckhardt': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'objects.': 0.16; 'represents.': 0.16; 'scope,': 0.16; 'subject:Query': 0.16; 'underlying': 0.16; 'world!")': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'thu,': 0.19; '>>>': 0.22; 'aug': 0.22; 'certainly': 0.24; 'header:In-Reply- To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'that.': 0.31; 'steven': 0.31; 'file': 0.32; 'run': 0.32; 'another': 0.32; 'open': 0.33; 'fri,': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; '+0200,': 0.36; 'possible': 0.36; 'represent': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'affect': 0.61; 'side': 0.67; 'apart': 0.72; 'no:': 0.84; 'same,': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=3Wh5OuM7AR3KVcquJ833vhILOkLe0S/xbiBneiejw3U=; b=fBMQis629enCfEYTRQ6Gi0rCwj2yDiJrDDkeP7ECqabhjN2XmTi0BueVTdZH2cEAnz EDQL1oPqmuC+cz66pLZJw4/HkZNeLvt6gzlgVdBEdT2e9VTdLXqu64EDRqJlBhdactBe 5jDutS7F3nxOzlTSMxVPTXZVjtnHCmx2huyX+iEChky1a3cyKt0DSSHxGHraHKCdhJrR aZnUQzgfZphebxtq++vFapCmhfR7C9eNz+um7CgHG+mjDBjoj8ts8Y3VMNeXle/0Mgi+ cI89nF6SVyfCCZGgszPfCw499AzteS1+a4yRNFuYAW2Tb2UfYKCiNiRVUkYokwHe6dOW rcRA== |
| MIME-Version | 1.0 |
| X-Received | by 10.52.72.195 with SMTP id f3mr104569vdv.59.1377273052038; Fri, 23 Aug 2013 08:50:52 -0700 (PDT) |
| In-Reply-To | <kkejea-2bs.ln1@satorlaser.homedns.org> |
| References | <mailman.68.1377067974.19984.python-list@python.org> <nqceea-aae.ln1@satorlaser.homedns.org> <kv32q9$rd2$1@news.albasani.net> <6oahea-u2n.ln1@satorlaser.homedns.org> <5216d6cc$0$29986$c3e8da3$5496439d@news.astraweb.com> <kkejea-2bs.ln1@satorlaser.homedns.org> |
| Date | Sat, 24 Aug 2013 01:50:51 +1000 |
| Subject | Re: Basic Python Query |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.167.1377273054.19984.python-list@python.org> (permalink) |
| Lines | 40 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1377273054 news.xs4all.nl 15867 [2001:888:2000:d::a6]:54535 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:52897 |
Show key headers only | View raw
On Fri, Aug 23, 2013 at 5:12 PM, Ulrich Eckhardt
<ulrich.eckhardt@dominolaser.com> wrote:
> Am 23.08.2013 05:28, schrieb Steven D'Aprano:
>>
>> On Thu, 22 Aug 2013 13:54:14 +0200, Ulrich Eckhardt wrote:
>>>
>>> When the Python object goes away, it doesn't necessarily affect
>>> thethread or file it represents.
>>
>>
>> That's certainly not true with file objects. When the file object goes
>> out of scope, the underlying low-level file is closed.
>
>
> Ahem, yes, but no: Calling close(fd) is not the same as destroying the file,
> I'm pretty sure it's still on my harddisk after that. That is also the
> difference to strings, where the Python object really is all there is to it.
> Similarly you can only customize the Python side of things with derivation,
> the other side will remain the same, apart from the data you write to the
> file or the code you run in the thread.
The file object doesn't represent the file on the disk; it represents
the "open file", which is a thing that you can have a handle (file
descriptor) to. That "thing" is indeed destroyed when the file object
is __del__'d, though it's possible to dispose of it sooner than that:
>>> f = open("test","w")
>>> with f:
f.write("Hello, world!")
13
>>> f
<_io.TextIOWrapper name='test' mode='w' encoding='cp1252'>
f has been closed at this point, and if I now go to open it in another
application, Python won't hold any locks; but the object still exists.
However, the general expectation is that the file object and the
open-file in the OS will correspond.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Basic Python Query chandan kumar <chandan_psr@yahoo.co.in> - 2013-08-21 14:50 +0800
Re: Basic Python Query Steven D'Aprano <steve@pearwood.info> - 2013-08-21 08:19 +0000
Re: Basic Python Query Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-08-21 11:11 +0200
Re: Basic Python Query Johannes Bauer <dfnsonfsduifb@gmx.de> - 2013-08-21 20:58 +0200
Re: Basic Python Query Fábio Santos <fabiosantosart@gmail.com> - 2013-08-21 23:50 +0100
Re: Basic Python Query Johannes Bauer <dfnsonfsduifb@gmx.de> - 2013-08-22 10:49 +0200
Re: Basic Python Query Ned Batchelder <ned@nedbatchelder.com> - 2013-08-21 20:06 -0400
Re: Basic Python Query Bob Martin <bob.martin@excite.com> - 2013-08-22 06:43 +0100
Re: Basic Python Query Ned Batchelder <ned@nedbatchelder.com> - 2013-08-22 09:45 -0400
Re: Basic Python Query Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-23 03:12 +0000
Re: Basic Python Query random832@fastmail.us - 2013-08-22 14:57 -0400
Re: Basic Python Query Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-08-22 18:22 -0400
Re: Basic Python Query random832@fastmail.us - 2013-08-23 01:08 -0400
Re: Basic Python Query Johannes Bauer <dfnsonfsduifb@gmx.de> - 2013-08-22 10:50 +0200
Re: Basic Python Query Fábio Santos <fabiosantosart@gmail.com> - 2013-08-22 09:46 +0100
Re: Basic Python Query Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-08-22 13:54 +0200
Re: Basic Python Query Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-23 03:28 +0000
Re: Basic Python Query Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-08-23 09:12 +0200
Re: Basic Python Query Chris Angelico <rosuav@gmail.com> - 2013-08-24 01:50 +1000
csiph-web