Open
Description
openedon Dec 30, 2016
I think it would be useful to have universal newlines mode for open
similar to Python. A short description of the mode for open
from Python 3.6 docs https://docs.python.org/3.6/library/functions.html#open .
Lines in the input can end in '\n', '\r', or '\r\n', and these are translated into '\n' before being returned to the caller.
When writing output to the stream any '\n' characters written are translated to the system default line separator, os.linesep.
Currently this needs to be handled manually in Julia which I think is a bit annoying and easy to enough to forget.
So I suggest the following:
- Add support for universal newlines to
open
as a flag to mode or a new keyword argument - Make universal newlines the default for methods reading from a stream and returning a string e.g.
readstring
,readlines
,eachline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment