Path: csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'table.': 0.07; 'definition,': 0.09; 'high-level': 0.09; 'integers': 0.09; 'structure,': 0.09; 'cc:addr:python-list': 0.11; 'assembler': 0.16; 'corresponds': 0.16; 'descriptor': 0.16; 'descriptor.': 0.16; 'descriptors.': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'integer.': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'numbered': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'roy': 0.16; 'simpson': 0.16; 'index': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'normally': 0.19; 'cc:addr:python.org': 0.22; 'header :User-Agent:1': 0.23; 'entries': 0.24; 'cheers,': 0.24; "haven't": 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'label': 0.30; "i'm": 0.30; "d'aprano": 0.31; 'steven': 0.31; 'table,': 0.31; 'file': 0.32; "we're": 0.32; 'open': 0.33; 'not.': 0.33; 'table': 0.34; 'trouble': 0.34; '"the': 0.34; 'created': 0.35; 'no,': 0.35; 'but': 0.35; 'there': 0.35; 'received:com.au': 0.36; 'charset:us- ascii': 0.36; 'example,': 0.37; 'starting': 0.37; 'sometimes': 0.38; 'filled': 0.38; 'received:211': 0.38; 'little': 0.38; 'does': 0.39; 'enough': 0.39; 'either': 0.39; 'tell': 0.60; 'content-disposition:inline': 0.62; "you've": 0.63; 'information': 0.63; 'smith': 0.68; 'article': 0.77; 'subject:skip:o 10': 0.84; 'safety,': 0.91 Date: Sat, 11 May 2013 08:25:41 +1000 From: Cameron Simpson To: Roy Smith Subject: Re: object.enable() anti-pattern MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) References: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=BPvrNysG c=1 sm=1 a=wom5GMh1gUkA:10 a=GCTqkX7shA8A:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=KPWSBcU8E6wA:10 a=VUfPOBp7AAAA:8 a=RA7hJJdoAAAA:8 a=kZ7UWmmPAAAA:8 a=dBhzj_v1AAAA:8 a=LsR_Bo8yhOmxYQQKTeoA:9 a=CjuIK1q_8ugA:10 a=5hK03km2n30A:10 a=pyH5b1fOeEsA:10 a=rsyBdmJBmesA:10 a=XhXetw9cZonJvfg3:21 a=mVVLAVbLIB9oyILb:21 a=ChdAjXE5lkUvdteQbhpnkQ==:117 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368224768 news.xs4all.nl 15964 [2001:888:2000:d::a6]:45861 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45122 On 10May2013 09:22, Roy Smith wrote: | In article <518cc239$0$29997$c3e8da3$5496439d@news.astraweb.com>, | Steven D'Aprano wrote: | > > int fd = 37; | > > | > > I've just created a file descriptor. There is not enough information | > > given to know if it corresponds to an open file or not. | > | > No, you haven't created a file descriptor. You've made up a number which | > C will allow you to use as an index into the file descriptor table, | > because C is a high-level assembler with very little in the way of type | > safety, and what little there is you can normally bypass. | | No, I've created a file descriptor, which is, by definition, an integer. | It has nothing to do with C. This is all defined by the POSIX | interface. For example, the getdtablesize(2) man page says: | | "The entries in the descriptor table are numbered with small integers | starting at 0. The call getdtablesize() returns the size of this table." [... snip ...] I'm with Steven here. You've made a number that can be used with calls that access the OS file descriptor table. But it isn't a file descriptor. (Yes, the in-program number is just a number either way.) The descriptor table is an in-kernel data structure, filled with file descriptors. All you have is a label that may or may not access a file descriptor. Anyway, we all know _what_ goes on. We're just having terminology issues. Cheers, -- Cameron Simpson My computer always does exactly what I tell it to do but sometimes I have trouble finding out what it was that I told it to do. - Dick Wexelblat