File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -184,6 +184,23 @@ Glossary
184184 A module written in C or C++, using Python's C API to interact with the core and
185185 with user code.
186186
187+ file object
188+ An object exposing a file-oriented API (with methods such as
189+ :meth: `read() ` or :meth: `write() `) to an underlying resource.
190+ Depending on the way it was created, a file object can mediate access
191+ to a real on-disk file or to another other type of storage or
192+ communication device (for example standard input/output, in-memory
193+ buffers, sockets, pipes, etc.). File objects are also called
194+ :dfn: `file-like objects ` or :dfn: `streams `.
195+
196+ There are actually three categories of file objects: raw binary
197+ files, buffered binary files and text files. Their interfaces are
198+ defined in the :mod: `io ` module. The canonical way to create a
199+ file object is by using the :func: `open ` function.
200+
201+ file-like object
202+ A synonym for :term: `file object `.
203+
187204 finder
188205 An object that tries to find the :term: `loader ` for a module. It must
189206 implement a method named :meth: `find_module `. See :pep: `302 ` for
Original file line number Diff line number Diff line change @@ -617,7 +617,7 @@ correspond to Unix system calls applicable to sockets.
617617
618618 .. index :: single: I/O control; buffering
619619
620- Return a :dfn : `file object ` associated with the socket. The exact
620+ Return a :term : `file object ` associated with the socket. The exact
621621 returned type depends on the arguments given to :meth: `makefile `. These
622622 arguments are interpreted the same way as by the built-in :func: `open `
623623 function.
Original file line number Diff line number Diff line change @@ -781,9 +781,9 @@ I/O objects (also known as file objects)
781781 single: stdout (in module sys)
782782 single: stderr (in module sys)
783783
784- A file object represents an open file. Various shortcuts are available
785- to create file objects: the :func: `open ` built-in function, and also
786- :func: `os.popen `, :func: `os.fdopen `, and the :meth: `makefile ` method
784+ A :term: ` file object ` represents an open file. Various shortcuts are
785+ available to create file objects: the :func: `open ` built-in function, and
786+ also :func: `os.popen `, :func: `os.fdopen `, and the :meth: `makefile ` method
787787 of socket objects (and perhaps by other functions or methods provided
788788 by extension modules).
789789
You can’t perform that action at this time.
0 commit comments