<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 28, 2016 at 9:23 AM, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">'string'.to_file('some_file') would just be io.write('string',<br>
'some_file'), and str.from_file('some_file') would be<br>
io.read('some_file').<br>
</blockquote>
<br>
Nick's observation about the mental model may be correct ( though I<br>
don't think so, frankly), but if it is, then this isn't any better<br>
than:<br>
<br>
open("some_path", 'w').write(string)<br>
<br>
" I need to open a file to write something to disk" isn't any harder<br>
to grok than "I need the io module to write something to disk".<br>
</blockquote>
<br></span>
The benefit here is that the `io` module is a natural place to put a file `read` and `write` function, and they don't need to be built-in.</blockquote><div><br></div><div>I'm coming around to this actually -- not because it's easier to grok than:</div><div><br></div><div>data = open('some_file').read()</div><div><br></div><div>but because it could be an atomic operation, and close the file properly. and Is easier to grok than:</div><div><br></div><div>with open('some_file') as infile:</div><div> data = infile.read()</div><div><br></div><div>and heck, it would even keep the door open to being made a built-in in the future.</div><div><br></div><div>Maybe it's time to hear from the OP on this one -- after all, most of us in the discussion are already really familiar with the options!</div><div><br></div><div>-CHB</div><div><br></div><div><br></div><div><br></div><div> </div></div>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R (206) 526-6959 voice<br>7600 Sand Point Way NE (206) 526-6329 fax<br>Seattle, WA 98115 (206) 526-6317 main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>