Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!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.044 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; 'plenty': 0.07; 'sure,': 0.09; 'python': 0.11; 'accepting': 0.14; '4:59': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'roy': 0.16; 'java,': 0.16; 'wrote:': 0.18; 'skip:f 30': 0.19; 'python?': 0.22; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'object.': 0.31; 'file': 0.32; 'class': 0.32; 'open': 0.33; 'fri,': 0.33; 'totally': 0.33; 'sense': 0.34; 'could': 0.34; "can't": 0.35; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'skip:f 40': 0.36; 'done': 0.36; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'flat': 0.60; 'different': 0.65; 'smith': 0.68; 'subject:skip:o 10': 0.84; 'imagine': 0.93; '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=KVie91ivNS/UWkJZRAkWCOXFRUd7h5JTzskxCN/jWaI=; b=a+G4mLjYl+y07VifNIO726AdUf2mHFvD0/7gnOaRfyQxZRSB+GCwo1IbnZ1RdYpokL ZCpQXcYUBPC2p1Q1N+yGexsF0PWI6zllLgKZee/cAYGu/i2XgbqdoGDauNrPB/RIQOSH +q9qwrzPNGJsD2gfik6TB3pEu7I/kAN2RBnXTl6x6U2nzL8/2PZMp4cLa7lkI6zTVqel kv9sevWop5rmRNTBQX3zFba7M9xNrdmtOq0Xx1YW5hoJq3/RE2Slj66IpjF3CSCAHEuS AXU5dOI66KR3BIk8zRXUYbs4ZLEU5Sh+V9Meb9A1lAeeklFWgd3LbezrZ7fMOVF1jSzn vdoQ== MIME-Version: 1.0 X-Received: by 10.52.120.83 with SMTP id la19mr7839746vdb.58.1368136549937; Thu, 09 May 2013 14:55:49 -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> Date: Fri, 10 May 2013 07:55:49 +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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368136558 news.xs4all.nl 15928 [2001:888:2000:d::a6]:44293 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45058 On Fri, May 10, 2013 at 4:59 AM, Roy Smith wrote: > It's not hard to imagine a > file class which could be used like: > > f = file("/path/to/my/file") > f.delete() > > That would be a totally different model from the current python file > object. And then there would be plenty of things you might want to do > to a file other than open it... > > file("/path/to/my/directory").chdir() > file("/dev/sdf").mount("/var/lib/whatever") > file("/mnt/swapfile").swapon() Sure, you can imagine it. But what does it do that can't be done with a moduleful of flat functions accepting strings? This makes sense in Java, I guess, but why do it in Python? ChrisA