Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'def': 0.06; 'subtle': 0.09; 'subject:not': 0.11; 'file,': 0.14; "file's": 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:Why': 0.16; 'utterly': 0.16; 'certainly': 0.17; 'wed,': 0.18; 'wrote:': 0.19; 'bytes': 0.21; 'header:In-Reply-To:1': 0.22; 'skip:" 30': 0.23; 'message-id:@mail.gmail.com': 0.24; "doesn't": 0.25; '"please': 0.28; "d'aprano": 0.28; 'steven': 0.28; 'announce': 0.30; 'received:209.85.210.174': 0.30; 'received:mail- iy0-f174.google.com': 0.30; 'space,': 0.31; "can't": 0.32; 'received:209.85': 0.32; 'received:google.com': 0.32; 'point,': 0.32; 'file': 0.33; 'method': 0.33; 'received:209.85.210': 0.33; 'pm,': 0.34; 'to:addr:python-list': 0.35; 'received:209': 0.35; 'end': 0.35; 'subject:?': 0.35; 'but': 0.37; 'subject:: ': 0.37; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; '2012': 0.62; 'vital': 0.71; 'contents,': 0.84 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:content-transfer-encoding; bh=XH3IdiJ2yzPucc347D4xnNfGPJ5cgSMOAaqh82h6MoI=; b=OAgIdKfVUstHd1KHyyWZaKfpTsZRQnflKR4W78ObzsQtJVhCwApZcyMrI+VTWsJwIO FY0SHloq+CCjIiGiEIOINfuf1FhEzXxYXMeDWH0HIv8qPo/fgidnQlsyIJ0DFgATQkfn JbmV0MDia8ZDs4YWAekCwpldMAUssLCSYgdcS+DZ7fS9r/CGOryDF1gipjOrnOoNEEgJ zQkpxSmJeu/YfWyZx2zQkJPXv5DJXDGw7B35ub6XqvqSXPr0AoL/1ODCah7uLDvDQy4B RpHwtVnp/jsiztjvXvpb9kLLLSAGyoe6XYdHe8niy98EoF8OSSsCw/FPKqLT4HQHO/id fuhA== MIME-Version: 1.0 In-Reply-To: <4f7be1e8$0$29999$c3e8da3$5496439d@news.astraweb.com> References: <38b3fc48-1d05-4373-b32e-64da95173864@pz2g2000pbc.googlegroups.com> <4f7be1e8$0$29999$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 4 Apr 2012 18:37:20 +1000 Subject: Re: No os.copy()? Why not? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1333528643 news.xs4all.nl 6881 [2001:888:2000:d::a6]:59108 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:22653 On Wed, Apr 4, 2012 at 3:53 PM, Steven D'Aprano wrote: > On Tue, 03 Apr 2012 15:46:31 -0400, D'Arcy Cain wrote: > >> def cp(infile, outfile): >> =A0 =A0open(outfile, "w").write(open(infile).read()) > > Because your cp doesn't copy the FILE, it copies the file's CONTENTS, > which are not the same thing. And, as a subtle point: This method can't create the file "at size". I don't know how it'll end up allocating space, but certainly there's no opportunity to announce to the OS at file open/create time "please allocate X bytes for this file". That may be an utterly trivial point, or a crucially vital one. ChrisA