Hello all, my first post here!
I’m looking for clarification on how the io.py module of the Python3 standard library works at a very high/conceptual level, and how the average user would use it in practice.
I’ve read the documentation from start to finish twice, and the following is my understanding based on what I inferred from the docs coupled with a very basic understanding of object-oriented programming.
The module provides a small number of top level callables such as io.open() (an alias for the built-in open()) that can be used to create a file object. It seems to be the case that open() can be used to create a wide range of file objects for many different applications, and that the actual object it returns depends on the parameters passed to it by the programmer. In some cases the returned object will actually be an interface to another, lower level, file object that is created simultaneously.
objects returned by open() are defined in, and instances of, classes defined within io.py - with the particular hierarchy of classes from which an object is constructed being determined by the parameters passed to open().
It seems to me that the average user can accomplish much using only the built-in open() and does not need to understand the io.py class hierarchy in order to create file objects that can be used to perform I/O operations on a wide range of virtual devices (not just the standard OS level files)
I’d be grateful if someone could weigh in on this and let me know if I’ve understood the theory correctly!
Edit: I may have misunderstood, it seems that perhaps open() is only used for creating a file object attached to an actual file, but I’m still unsure