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

Nick Eubank nickeubank at gmail.com
Tue Mar 22 23:32:28 EDT 2016


My sense is that writing a single string is rare for software developers,
but it's pretty common among data scientists -- I output "single strings"
to LaTeX all the time.

On Tue, Mar 22, 2016 at 8:29 PM Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

>
> 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/20160323/ae5eb126/attachment-0001.html>


More information about the Python-ideas mailing list