Skip to content

csv.get_dialect() returns a _csv.Dialect object, not csv.Dialect as documented. #138352

@Dr-Irv

Description

@Dr-Irv

The documentation at https://docs.python.org/3/library/csv.html#csv.Dialect indicates that this class is what is returned when calling csv.get_dialect(). But the C implemented class _csv.Dialect() is returned instead.

>>> import csv
>>> csv.get_dialect("excel")
<_csv.Dialect object at 0x0000026C0004DBC0>

This makes writing typesafe code that uses Dialect a challenge. See related typeshed issue at python/typeshed#14667

It's not clear whether this is a documentation or implementation issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    No status

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions