Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.087 X-Spam-Evidence: '*H*': 0.83; '*S*': 0.00; 'explicitly': 0.05; 'python': 0.11; '"file': 0.16; 'fail,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'janssen': 0.16; 'rarely': 0.16; 'wraps': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'passing': 0.19; 'creating': 0.23; 'days,': 0.24; 'pointer': 0.24; 'fairly': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; 'leave': 0.29; 'generally': 0.29; 'wonder': 0.29; "doesn't": 0.30; 'absolute': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'went': 0.31; '>>>>': 0.31; 'view.': 0.31; 'file': 0.32; 'languages': 0.32; 'another': 0.32; 'open': 0.33; 'beginning': 0.33; 'fri,': 0.33; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'point.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; "didn't": 0.36; 'useful': 0.36; 'received:209': 0.37; 'step': 0.37; 'being': 0.38; 'initially': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'ago,': 0.61; 'hardware': 0.61; 'entire': 0.61; 'back': 0.62; 'high': 0.63; 'such': 0.63; 'life': 0.66; 'close': 0.67; 'fact,': 0.69; 'coherent': 0.84; 'common,': 0.84; 'subject:skip:o 10': 0.84; "they'd": 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=+DnDs2TAdqsHqJ+n+WdAFWiZlFDR4SxZzxanqtIpIUA=; b=s/t4/zHfLJ9RGSvmhQAvWfJRGyAjcRnMPxhYzjFlNoqnWxL01s9ETpj1EfkESd+xJ2 ekOF4pmw88BC4zx/59fYhy2ZhIrfRhEkt3jZxdRsP6/MNX5mxzGTcy4ZWyx3+CpCS6wO 7odvklZNO38YgeEREb8QZSDKJq3pPYnuC5PjeIbyAQ4IfuUW62VieyySuGddqWRj48Op AlZHKV9pMlVRq0F9SZj8Xqi5RxyHNX0y+MLNlQxLLSRVsmvGTH3AnsPvo6vEeFEllvrr FLe/AiA0nRYKd3nZnULop/dwszxUD6g0GBBCTjKKRzruighJ+VGMblfZJPA3J1IDzppX Gvxg== MIME-Version: 1.0 X-Received: by 10.58.15.193 with SMTP id z1mr9929796vec.40.1368157585462; Thu, 09 May 2013 20:46:25 -0700 (PDT) In-Reply-To: References: <518a123c$0$11094$c3e8da3@news.astraweb.com> <518b32ef$0$11120$c3e8da3@news.astraweb.com> <518be931$0$29997$c3e8da3$5496439d@news.astraweb.com> <518c5bbc$0$29997$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 10 May 2013 13:46:25 +1000 Subject: Re: object.enable() anti-pattern From: Chris Angelico 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368157593 news.xs4all.nl 15877 [2001:888:2000:d::a6]:49812 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45080 On Fri, May 10, 2013 at 1:19 PM, Mark Janssen wrote: >> I think where things went pear shaped is when you made the statement: >> >>>> There is no sensible use-case for creating a file OBJECT unless it >>>> initially wraps an open file pointer. >> >> That's a pretty absolute point of view. Life is rarely so absolute. > > In the old days, it was useful to have fine-grained control over the > file object because you didn't know where it might fail, and the OS > didn't necessarily give you give good status codes. So being able to > step through the entire process was the job of the progammers. I don't know what you mean by the "old days", but a couple of decades ago, there were no such things as "file objects". You call a function to open a file, you get back a number. You explicitly close that by calling another function and passing it that number. In fact, there is no way to have a "file object" that doesn't have an open file associated with it, because it's simply... a number. > Now, with languages so high like python and hardware so common, it > almost is never necessary, so he has some point. A closed file > pointer is useful from a OS-progamming point-of-view though because > you generally never want to leave files open where they'd block other > I/O. I'm beginning to wonder if you and Dihedral are swapping notes. Dihedral's been sounding fairly coherent lately. ChrisA