On 11/11/2019 11:08 AM, Veek M wrote:

https://docs.python.org/3/library/io.html
'Text I/O expects and produces str objects. This means that whenever the
backing store is natively made of bytes (such as in the case of a file),
encoding and decoding of data is made transparently as well as optional
translation of platform-specific newline characters.'

1. What is a backing store?

Whatever you can read from or write to. Unix uses 'file' with the same extended sense. Reread the Overview section above.

2. How does it fit in/influence what we pass to the fileObject/stream/
filelikeObject.method()

What the text you quote says is that if the source or destination for a text stream is actually bytes, you still receive or pass text because the translation is done for you (if you have opened the text stream with the right arguments.

Google just says the backing store is secondary MEMORY - Harddisk cache
or for paging.. but how does that relate to Python?

Different languages have different data models of what one is manipulating. In assembly and C, one manipulates fixed-length blocks of main memory, which itself is a sequence of bytes numbered 0, ..., N. So a backup store is 'secondary memory'.

Python manipulates 'information objects' in an 'object space'. Python objects of type str and bytes, and only those two types, can be input and output. Other objects are converted from or to one of those types for input and output.

I just concluded the backing store was a buffer?

Text and binary streams use a buffer, raw streams do not.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to