Skip to content

open() built in's doc does not say what the buffering default of -1 means #93600

Open
@mark-summerfield

Description

@mark-summerfield

On this page https://docs.python.org/3.10/library/functions.html#open the signature of the function is shown as:

open(file, mode='r', buffering=- 1, encoding=None, errors=None, newline=None, closefd=True, opener=None)

Notice the spurious space between the - and the 1.

But more importantly, the explanation of bufferings meaning is:

buffering is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size in bytes of a fixed-size chunk buffer.

In other words, it does not explain what the -1 default means. I assume it means "use the default buffering size for the given mode"; but it really ought to say.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions