[Python-Dev] sure [was: Ext4 data loss]

Jim Jewett jimjjewett at gmail.com
Fri Mar 13 05:13:09 CET 2009


[new name instead of "wait" -- but certainty is too long, patience too
hard to spell, etc...]

>> class file(_file): ...
>>     def flush(self, sure=0):
>         super().flush(self)
>         if sure < 0.25:
>             return
>         if sure < 0.5 and os.fdatasync:
>             os.fdatasync(self.fileno())
> ...

Steven D'Aprano asked
> Why are you giving the user the illusion of fine control by making the
> wait parameter a continuous variable and then using it as if it were a
> discrete variable?

We don't know how many possible values there will be, or whether they
will be affected by environmental settings.  Developers will not
always know what sort of systems users will have, but they can
indicate (with a ratio) where in the range (slow+safe):(fast+risky)
they rate this particular flush.

Before this discussion, I knew about sync, but had not paid attention
even to datasync, let alone fullsync.  I have no idea which additional
options may be relevant in the future, or on smaller devices or other
storage media.

I do expect specific intermediate values (such as 0.3) to be
interpreted differently on a laptop than on a desktop.

-jJ


More information about the Python-Dev mailing list