On Wed, Apr 4, 2012 at 3:53 PM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
> On Tue, 03 Apr 2012 15:46:31 -0400, D'Arcy Cain wrote:
>
>> def cp(infile, outfile):
>>    open(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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to