A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-March/087239.html below:

[Python-Dev] Ext4 data loss

[Python-Dev] Ext4 data loss [Python-Dev] Ext4 data lossGreg Ewing greg.ewing at canterbury.ac.nz
Sun Mar 15 23:25:04 CET 2009
Nick Coghlan wrote:

> It actually wouldn't be a bad place to put a "create a temporary file
> and rename it to <name> when closing it" helper class.

I'm not sure it would be a good idea to make that
behaviour automatic on closing. If anything goes
wrong while writing the file, you *don't* want the
rename to happen, otherwise it defeats the purpose.

It would be okay to have an explicit close_and_rename()
method, although there wouldn't be much gained over
just calling os.rename() afterwards.

What might make more sense is a context manager,
e.g.

   with renaming_file("blarg.txt", "w") as f:
     ...

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4