Skip to content

TextIO/BinaryIO: Mismatch between documentation and implementation #518

@srittau

Description

@srittau

The typing documentation for 3.6.4rc1 at states:

This (typing.io) defines the generic type IO[AnyStr] and aliases TextIO and BinaryIO for respectively IO[str] and IO[bytes].

In the current implementation TextIO and BinaryIO are not aliases, but instead derived from IO. I am not sure whether this is a documentation or implementation problem, but the current implementation causes problems, since values of type IO[...], and especially IO[Any] can not be assigned where TextIO or BinaryIO is expected.

See python/typeshed#1780 for a real-world example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions