Skip to content

open() built-in function: let it have encoding="utf-8" and newline="\n" by default #129686

@PedanticHacker

Description

@PedanticHacker

This is the signature of the open() built-in function:

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

Proposal number 1

Since Python universally migrated to the UTF-8 character encoding a long time ago, set the encoding parameter of the open() built-in function to default to encoding="utf-8".

Proposal number 2

Because the Windows operating system also handles \n as a newline character since practically forever, set newline="\n" as a default parameter of the open() built-in function.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions