No os.copy()? Why not?

Chris Angelico rosuav at gmail.com
Wed Apr 4 21:30:45 EDT 2012


On Thu, Apr 5, 2012 at 1:15 AM, Steve Howell <showell30 at yahoo.com> wrote:
> On Apr 4, 1:37 am, Chris Angelico <ros... at gmail.com> wrote:
>> 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
>
> FWIW shutil.py doesn't do anything particularly fancy with respect to
> creating files "at size", unless I'm missing something:

So it doesn't. However, that's current implementation, and it's
entirely possible that a future version might add that feature - it
wouldn't break any existing code, and would improve file system
performance. Doing it yourself means you miss out on any such
enhancements.

ChrisA



More information about the Python-list mailing list