[I18n-sig] Modified open() builtin (Re: Python Character Model)

Tim Peters tim.one@home.com
Mon, 12 Feb 2001 20:45:30 -0500

[Paul Prescod]
> It has nothing to do with awareness of il8n issues. The fundamental
> question is whether you expect to get text back from a read()
> or binary.

> C already addresses that distinction ("r" vs "rb" open modes).

> Python is documented as only using the distinction to handle line
> ends.

Where?  Not in the open() docs.  They're uselessly vague about the
differences between 'r' and 'rb' (and don't mention line ends at all --
you're hallucinating that), because C is too and Python's semantics *are*
C's here.  Nevertheless, "When opening a binary file, you should append 'b'
to the mode value for improved portability. (It's useful even on systems
which don't treat binary and text files differently, where it serves as
documentation.)".  True enough, and good enough for newbies.  Although, as I
said before, I think Python should drop C's notion of text mode in favor of
its own (because C's notion is wildly platform-dependent).

> We want to create totally different object types based on the flag.

Which flag?  "b"?  Fine by me -- but that's what I said at the start.