Idiom for shelling out to $EDITOR/$PAGER?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Fri Dec 23 04:44:31 EST 2011
On Fri, 23 Dec 2011 09:28:52 +0100, Peter Otten wrote:
>> -proper & efficient detection of file-change, to know whether the user
>> actually did anything
>
> Just read the whole thing back into memory and compare the string to the
> original data. The file has to be quite long for the checksum
> calculation to be worthwhile.
I don't think so. No matter how long the file is, the checksum is always
going to do far more work than a simple string comparison. A string
comparison can short-circuit on the first difference; the checksum must
always process both files in their entirety.
--
Steven
More information about the Python-list
mailing list