User talk:JimD

From Rosetta Code

Feel free to leave JimD a message here. Obviously it won't be private and it might be forever before I get around to reading it. I'm the same JimD on Wikipedia and a few of the Wikimedia projects. Any response will be posted to your talk page (unless otherwise indicated) ... and your message will probably be erased from this page shortly after I've read it (just to avoide clutter).

Glad to have you aboard. BTW...Email works on RC; you might want to verify an email address.--Short Circuit 20:35, 12 October 2007 (MDT)

File I/O[edit]

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, ... --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. JimD 14:58, 20 November 2008 (UTC)

Maximal Value[edit]

I see what you are getting at, but you want to set a flag for first value then set the minimum or maximum to be the first value rather than some sentinel value which could change over time. on reading subsequent values you do the comparison to update the minimal/maximal value appropriately. Unfortunately I am away from Python at the moment so cannot update your addition. --Paddy3118 15:57, 26 November 2008 (UTC)

Thinking a bit more,

 max(stream, key=int)

Might do for your case too (assuming the stream returns character representations of integers). If you want error handling on the conversion to ints then you could write a custom key function --Paddy3118 16:09, 26 November 2008 (UTC)