User talk:JimD: Difference between revisions

(shutil.copyfile is all you need.)
Line 5:
== [[File I/O]] ==
Hi Jim, If you took a look at the source for shutil.copyfile then you would see that it is as robust as the extra code you have written. Why re-invent what is available in the Python standard library? I would prefer the Python entry point users at using the succinct shutil.copyfile rather than them having to remember what mode to open the files, closing files, ... --[[User:Paddy3118|Paddy3118]] 11:47, 20 November 2008 (UTC)
: Paddy, I wrote the additional code to demonstrate how to open, read from and write to files. The task seems to be about doing file I/O (in the broader sense). As written it just so happens that shutil.copyfile() satisfies the narrow specification of the task. However, using this approach does nothing to inform the reader how other file I/O is done in Python. It doesn't offer a reasonable basis for comparing Python's file I/O with that of other languages. I would argue that the specific task is deficient since it doesn't actually specify that anything is to be *done* to transform or filter the input as it's passed through to the output. However, the place to comment on that deficiency would be in that page's discussion. [[User:JimD|JimD]] 14:58, 20 November 2008 (UTC)
Anonymous user