| OLD | NEW |
| 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 It implements the :class:`RawIOBase` interface (and therefore the | 468 It implements the :class:`RawIOBase` interface (and therefore the |
| 469 :class:`IOBase` interface, too). | 469 :class:`IOBase` interface, too). |
| 470 | 470 |
| 471 The *name* can be one of two things: | 471 The *name* can be one of two things: |
| 472 | 472 |
| 473 * a character string or bytes object representing the path to the file | 473 * a character string or bytes object representing the path to the file |
| 474 which will be opened; | 474 which will be opened; |
| 475 * an integer representing the number of an existing OS-level file descriptor | 475 * an integer representing the number of an existing OS-level file descriptor |
| 476 to which the resulting :class:`FileIO` object will give access. | 476 to which the resulting :class:`FileIO` object will give access. |
| 477 | 477 |
| 478 The *mode* can be ``'r'``, ``'w'`` or ``'a'`` for reading (default), writing, | 478 The *mode* can be ``'x'``, ``'r'``, ``'w'`` or ``'a'`` for creating, |
| 479 or appending. The file will be created if it doesn't exist when opened for | 479 reading (default), writing, or appending. The file will be created if it |
| 480 writing or appending; it will be truncated when opened for writing. Add a | 480 doesn't exist when opened for writing or appending; it will be |
| 481 ``'+'`` to the mode to allow simultaneous reading and writing. | 481 truncated when opened for writing. An IOError will be raise if it |
| 482 already exists when opened for creating. Opening a file for creating |
| 483 implies writing, so this mode behaves in a similar way to ``'w'``. |
| 484 Add a ``'+'`` to the mode to allow simultaneous reading and writing. |
| 482 | 485 |
| 483 The :meth:`read` (when called with a positive argument), :meth:`readinto` | 486 The :meth:`read` (when called with a positive argument), :meth:`readinto` |
| 484 and :meth:`write` methods on this class will only make one system call. | 487 and :meth:`write` methods on this class will only make one system call. |
| 485 | 488 |
| 486 In addition to the attributes and methods from :class:`IOBase` and | 489 In addition to the attributes and methods from :class:`IOBase` and |
| 487 :class:`RawIOBase`, :class:`FileIO` provides the following data | 490 :class:`RawIOBase`, :class:`FileIO` provides the following data |
| 488 attributes and methods: | 491 attributes and methods: |
| 489 | 492 |
| 490 .. attribute:: mode | 493 .. attribute:: mode |
| 491 | 494 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 they can arise from doing I/O in a :mod:`signal` handler. If a thread tries to | 849 they can arise from doing I/O in a :mod:`signal` handler. If a thread tries to |
| 847 renter a buffered object which it is already accessing, a :exc:`RuntimeError` is | 850 renter a buffered object which it is already accessing, a :exc:`RuntimeError` is |
| 848 raised. Note this doesn't prohibit a different thread from entering the | 851 raised. Note this doesn't prohibit a different thread from entering the |
| 849 buffered object. | 852 buffered object. |
| 850 | 853 |
| 851 The above implicitly extends to text files, since the :func:`open()` function | 854 The above implicitly extends to text files, since the :func:`open()` function |
| 852 will wrap a buffered object inside a :class:`TextIOWrapper`. This includes | 855 will wrap a buffered object inside a :class:`TextIOWrapper`. This includes |
| 853 standard streams and therefore affects the built-in function :func:`print()` as | 856 standard streams and therefore affects the built-in function :func:`print()` as |
| 854 well. | 857 well. |
| 855 | 858 |
| OLD | NEW |