Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1739)

Delta Between Two Patch Sets: Doc/library/io.rst

Issue 12797: io.FileIO and io.open should support openat
Left Patch Set: Created 1 year, 7 months ago
Right Patch Set: Created 1 year, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Doc/library/functions.rst ('k') | Lib/_pyio.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 :mod:`io` --- Core tools for working with streams 1 :mod:`io` --- Core tools for working with streams
2 ================================================= 2 =================================================
3 3
4 .. module:: io 4 .. module:: io
5 :synopsis: Core tools for working with streams. 5 :synopsis: Core tools for working with streams.
6 .. moduleauthor:: Guido van Rossum <guido@python.org> 6 .. moduleauthor:: Guido van Rossum <guido@python.org>
7 .. moduleauthor:: Mike Verdone <mike.verdone@gmail.com> 7 .. moduleauthor:: Mike Verdone <mike.verdone@gmail.com>
8 .. moduleauthor:: Mark Russell <mark.russell@zen.co.uk> 8 .. moduleauthor:: Mark Russell <mark.russell@zen.co.uk>
9 .. moduleauthor:: Antoine Pitrou <solipsis@pitrou.net> 9 .. moduleauthor:: Antoine Pitrou <solipsis@pitrou.net>
10 .. moduleauthor:: Amaury Forgeot d'Arc <amauryfa@gmail.com> 10 .. moduleauthor:: Amaury Forgeot d'Arc <amauryfa@gmail.com>
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 to which the resulting :class:`FileIO` object will give access. 472 to which the resulting :class:`FileIO` object will give access.
473 473
474 The *mode* can be ``'r'``, ``'w'`` or ``'a'`` for reading (default), writing, 474 The *mode* can be ``'r'``, ``'w'`` or ``'a'`` for reading (default), writing,
475 or appending. The file will be created if it doesn't exist when opened for 475 or appending. The file will be created if it doesn't exist when opened for
476 writing or appending; it will be truncated when opened for writing. Add a 476 writing or appending; it will be truncated when opened for writing. Add a
477 ``'+'`` to the mode to allow simultaneous reading and writing. 477 ``'+'`` to the mode to allow simultaneous reading and writing.
478 478
479 The :meth:`read` (when called with a positive argument), :meth:`readinto` 479 The :meth:`read` (when called with a positive argument), :meth:`readinto`
480 and :meth:`write` methods on this class will only make one system call. 480 and :meth:`write` methods on this class will only make one system call.
481 481
482 A custom opener can be used by passing a callable as *opener*. The 482 A custom opener can be used by passing a callable as *opener*. The underlying
483 underlying file descriptor for the file object is then obtained by calling 483 file descriptor for the file object is then obtained by calling *opener* with
484 *opener* with (*name*, *flags*). 484 (*name*, *flags*). *opener* must return an open file descriptor (passing
485 :mod:`os.open` as *opener* results in functionality similar to passing
486 ``None``).
485 487
486 In addition to the attributes and methods from :class:`IOBase` and 488 In addition to the attributes and methods from :class:`IOBase` and
487 :class:`RawIOBase`, :class:`FileIO` provides the following data 489 :class:`RawIOBase`, :class:`FileIO` provides the following data
488 attributes and methods: 490 attributes and methods:
489 491
490 .. attribute:: mode 492 .. attribute:: mode
491 493
492 The mode as given in the constructor. 494 The mode as given in the constructor.
493 495
494 .. attribute:: name 496 .. attribute:: name
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 they can arise from doing I/O in a :mod:`signal` handler. If a thread tries to 852 they can arise from doing I/O in a :mod:`signal` handler. If a thread tries to
851 renter a buffered object which it is already accessing, a :exc:`RuntimeError` is 853 renter a buffered object which it is already accessing, a :exc:`RuntimeError` is
852 raised. Note this doesn't prohibit a different thread from entering the 854 raised. Note this doesn't prohibit a different thread from entering the
853 buffered object. 855 buffered object.
854 856
855 The above implicitly extends to text files, since the :func:`open()` function 857 The above implicitly extends to text files, since the :func:`open()` function
856 will wrap a buffered object inside a :class:`TextIOWrapper`. This includes 858 will wrap a buffered object inside a :class:`TextIOWrapper`. This includes
857 standard streams and therefore affects the built-in function :func:`print()` as 859 standard streams and therefore affects the built-in function :func:`print()` as
858 well. 860 well.
859 861
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7