Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] best place for an atomic file API

"Martin v. Löwis"martin at v.loewis.de
Thu Feb 16 11:08:26 CET 2012


Am 16.02.2012 10:54, schrieb Victor Stinner:> Most users don't need a truly ACID write, but implement their own> best-effort function. Instead of having a different implement in each> project, Python can provide something better, especially when the OS> provides low level function to implement such feature.It's then critical how this is named, IMO (and exactly what semanticsit comprises). Calling it "atomic" when it is not is a mistake.Also notice that one user commented that that he already implementedsomething like this, and left out the issue of *permissions*. I foundthat interesting, since preserving permissions might indeed arequirement in a lot of "in-place update" use cases, but hasn't beenconsidered in this discussion yet.So rather than providing a mechanism for atomic writes, I thinkproviding a mechanism to update a file is what people might need.One way of providing this might be a "u" mode for open, whichupdates an existing file on close (unlike "a", which appends,and unlike "w", which truncates first).Regards,Martin


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp