<div dir="ltr">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. </div><br><div class="gmail_quote"><div dir="ltr">On Tue, Mar 22, 2016 at 8:29 PM Alexander Belopolsky <<a href="mailto:alexander.belopolsky@gmail.com">alexander.belopolsky@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 22, 2016 at 11:06 PM, Nick Eubank <span dir="ltr"><<a href="mailto:nickeubank@gmail.com" target="_blank">nickeubank@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">it seems a simple `to_file` method on strings (essentially wrapping a context-manager) would be really nice</blockquote></div><br></div></div><div dir="ltr"><div class="gmail_extra">-1</div><div class="gmail_extra"><br></div><div class="gmail_extra">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. </div></div>
</blockquote></div>