diff options
| author | Yves Weissig <yves@weissig.me> | 2023-08-18 17:52:57 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-09-11 06:07:47 +0200 |
| commit | 369b498219be791ebec8233208f08f07621b8359 (patch) | |
| tree | 01bfdce78ebd133857950290e979694bd64b57d3 /docs/ref | |
| parent | ecb6085f6fdb6319656b54cc92e6a91c1df47f23 (diff) | |
Fixed #34642 -- Added File.open() support for *args and **kwargs.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/files/file.txt | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/docs/ref/files/file.txt b/docs/ref/files/file.txt index 650bbb7079..ea9bf0968e 100644 --- a/docs/ref/files/file.txt +++ b/docs/ref/files/file.txt @@ -46,11 +46,12 @@ The ``File`` class The read/write mode for the file. - .. method:: open(mode=None) + .. method:: open(mode=None, *args, **kwargs) Open or reopen the file (which also does ``File.seek(0)``). The ``mode`` argument allows the same values - as Python's built-in :func:`python:open()`. + as Python's built-in :func:`python:open()`. ``*args`` and ``**kwargs`` + are passed after ``mode`` to Python's built-in :func:`python:open`. When reopening a file, ``mode`` will override whatever mode the file was originally opened with; ``None`` means to reopen with the original @@ -58,6 +59,10 @@ The ``File`` class It can be used as a context manager, e.g. ``with file.open() as f:``. + .. versionchanged:: 5.0 + + Support for passing ``*args`` and ``**kwargs`` was added. + .. method:: __iter__() Iterate over the file yielding one line at a time. |
