On 24.06.2014 06:36, Gil Cottle wrote:
> If not, adding a flag would be useful for text file-writing/reading when
> running on Windows, but it could also be a source of issues for people
> trying to write binary/text data depending on the defaults. Any thoughts on
> this?

For what its worth, I think the python way is the most clean way, with
respect to interoperability and platform independence. This is described
in a quite convoluted way in the [documentation for the open builtin][0].

They basically implement text mode themselves and don’t let the OS know
about it. On the OS side, they open all files in binary mode. In their
text mode implementation, they convert all newlines to '\n' while
reading and all '\n's to the platform newline while writing.

   [0]: https://docs.python.org/3/library/functions.html#open

p.s. Don’t let your self get distracted from the “deprecated” in the
mode table; this only refers to the mode string, not to the usage of
universal newlines using the `newline` keyword argument, described a bit
below the mode table.

> 
> Thanks,
> Gil Cottle
> 
> 
> 
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
> 

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to