[Python-ideas] `to_file()` method for strings

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Mar 22 23:29:24 EDT 2016


On Tue, Mar 22, 2016 at 11:06 PM, Nick Eubank <nickeubank at gmail.com> wrote:

> it seems a simple `to_file` method on strings (essentially wrapping a
> context-manager) would be really nice


-1

It is a rare situation when you would want to write just a single string to
a file.   In most cases you write several strings and or do other file
operations between opening and closing a file stream.  The proposed
to_file() method may become an attractive nuisance leading to highly
inefficient code.  Remember: opening or closing a file is still in most
setups a mechanical operation that involves moving macroscopic physical
objects, not just electrons.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160322/f2e4b1b7/attachment.html>


More information about the Python-ideas mailing list