python-dev
[Prev] Thread [Next] | [Prev] Date [Next]
Re: [Python-Dev] Ext4 data loss Greg Ewing Mon Mar 16 10:02:29 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
_______________________________________________
Python-Dev mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/alexiscircle%40gmail.com
- Re: [Python-Dev] Ext4 data loss, (continued)
- Re: [Python-Dev] Ext4 data loss Toshio Kuratomi
- Re: [Python-Dev] Ext4 data loss Martin v. Löwis
- Re: [Python-Dev] Ext4 data loss Toshio Kuratomi
- Re: [Python-Dev] Ext4 data loss Nick Coghlan
- Re: [Python-Dev] Ext4 data loss Mikko Ohtamaa
- Re: [Python-Dev] Ext4 data loss Zvezdan Petkovic
- Re: [Python-Dev] Ext4 data loss Martin v. Löwis
- Re: [Python-Dev] Ext4 data loss Zvezdan Petkovic
- Re: [Python-Dev] Ext4 data loss Andrew McNabb
- Re: [Python-Dev] Ext4 data loss Nick Coghlan
- Re: [Python-Dev] Ext4 data loss Greg Ewing <=
- Re: [Python-Dev] Ext4 data loss Nick Coghlan
- Re: [Python-Dev] Ext4 data loss Valentino Volonghi
- Re: [Python-Dev] Ext4 data loss Eric Smith
- Re: [Python-Dev] Ext4 data loss Antoine Pitrou
- Re: [Python-Dev] Ext4 data loss Eric Smith
- Re: [Python-Dev] Ext4 data loss Steven D'Aprano
- Re: [Python-Dev] [Python-ideas] Ext4 data loss zooko
- Message not available
- Re: [Python-Dev] Ext4 data loss Hrvoje Niksic
- Re: [Python-Dev] Ext4 data loss Martin v. Löwis
- Re: [Python-Dev] Ext4 data loss Greg Ewing